Class: RosettAi::Content::PackManifest

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

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

#dataObject (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.

Parameters:

  • path (Object)

    the path

Returns:



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

#authorString

Return the author name.

Returns:

  • (String)


46
47
48
# File 'lib/rosett_ai/content/pack_manifest.rb', line 46

def author = data['author']
# Return the manifest contents hash.
# @return [Hash]

#behaviour_filesArray<String>

Return the list of behaviour file paths.

Returns:

  • (Array<String>)


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>]

#contentsHash

Return the manifest contents hash.

Returns:

  • (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>]

#descriptionString

Return the human-readable description.

Returns:

  • (String)


43
44
45
# File 'lib/rosett_ai/content/pack_manifest.rb', line 43

def description = data['description']
# Return the author name.
# @return [String]

#design_filesArray<String>

Return the list of design file paths.

Returns:

  • (Array<String>)


55
# File 'lib/rosett_ai/content/pack_manifest.rb', line 55

def design_files = contents['designs'] || []

#nameString

Return the pack name.

Returns:

  • (String)


34
35
36
# File 'lib/rosett_ai/content/pack_manifest.rb', line 34

def name = data['name']
# Return the version string.
# @return [String]

#tier_requiredString

Return the minimum tier required for this pack.

Returns:

  • (String)


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]

#versionString

Return the version string.

Returns:

  • (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]