Class: RosettAi::Content::PackManifest
- Inherits:
-
Object
- Object
- RosettAi::Content::PackManifest
- Defined in:
- lib/rosett_ai/content/pack_manifest.rb
Overview
Loads, validates, and provides access to content pack manifest data.
Manifest files are YAML (parsed with safe_load only) and validated against the content_pack_manifest_schema.json schema.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
Class Method Summary collapse
-
.from_file(path) ⇒ PackManifest
Load a pack manifest from a YAML file.
Instance Method Summary collapse
-
#author ⇒ String
Return the author name.
-
#behaviour_files ⇒ Array<String>
Return the list of behaviour file paths.
-
#contents ⇒ Hash
Return the manifest contents hash.
-
#description ⇒ String
Return the human-readable description.
-
#design_files ⇒ Array<String>
Return the list of design file paths.
-
#initialize(data) ⇒ PackManifest
constructor
A new instance of PackManifest.
-
#name ⇒ String
Return the pack name.
-
#tier_required ⇒ String
Return the minimum tier required for this pack.
-
#version ⇒ String
Return the version string.
Constructor Details
#initialize(data) ⇒ PackManifest
Returns a new instance of PackManifest.
18 19 20 21 |
# File 'lib/rosett_ai/content/pack_manifest.rb', line 18 def initialize(data) @data = data validate! end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
16 17 18 |
# File 'lib/rosett_ai/content/pack_manifest.rb', line 16 def data @data end |
Class Method Details
.from_file(path) ⇒ PackManifest
Load a pack manifest from a YAML file.
27 28 29 30 |
# File 'lib/rosett_ai/content/pack_manifest.rb', line 27 def self.from_file(path) data = RosettAi::YamlLoader.load_file(path) new(data) end |
Instance Method Details
#author ⇒ String
Return the author name.
46 47 48 |
# File 'lib/rosett_ai/content/pack_manifest.rb', line 46 def = data['author'] # Return the manifest contents hash. # @return [Hash] |
#behaviour_files ⇒ Array<String>
Return the list of behaviour file paths.
52 53 54 |
# File 'lib/rosett_ai/content/pack_manifest.rb', line 52 def behaviour_files = contents['behaviours'] || [] # Return the list of design file paths. # @return [Array<String>] |
#contents ⇒ Hash
Return the manifest contents hash.
49 50 51 |
# File 'lib/rosett_ai/content/pack_manifest.rb', line 49 def contents = data['contents'] || {} # Return the list of behaviour file paths. # @return [Array<String>] |
#description ⇒ String
Return the human-readable description.
43 44 45 |
# File 'lib/rosett_ai/content/pack_manifest.rb', line 43 def description = data['description'] # Return the author name. # @return [String] |
#design_files ⇒ Array<String>
Return the list of design file paths.
55 |
# File 'lib/rosett_ai/content/pack_manifest.rb', line 55 def design_files = contents['designs'] || [] |
#name ⇒ String
Return the pack name.
34 35 36 |
# File 'lib/rosett_ai/content/pack_manifest.rb', line 34 def name = data['name'] # Return the version string. # @return [String] |
#tier_required ⇒ String
Return the minimum tier required for this pack.
40 41 42 |
# File 'lib/rosett_ai/content/pack_manifest.rb', line 40 def tier_required = data['tier_required'] # Return the human-readable description. # @return [String] |
#version ⇒ String
Return the version string.
37 38 39 |
# File 'lib/rosett_ai/content/pack_manifest.rb', line 37 def version = data['version'] # Return the minimum tier required for this pack. # @return [String] |