Class: Capsium::Package::Metadata
- Inherits:
-
Object
- Object
- Capsium::Package::Metadata
- Extended by:
- Forwardable
- Defined in:
- lib/capsium/package/metadata.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path) ⇒ Metadata
constructor
A new instance of Metadata.
- #save_to_file(output_path = @path) ⇒ Object
Constructor Details
#initialize(path) ⇒ Metadata
Returns a new instance of Metadata.
20 21 22 23 24 25 26 27 |
# File 'lib/capsium/package/metadata.rb', line 20 def initialize(path) @path = path @config = if File.exist?(path) MetadataData.from_json(File.read(path)) else MetadataData.new end end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
11 12 13 |
# File 'lib/capsium/package/metadata.rb', line 11 def config @config end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
11 12 13 |
# File 'lib/capsium/package/metadata.rb', line 11 def path @path end |
Instance Method Details
#save_to_file(output_path = @path) ⇒ Object
29 30 31 |
# File 'lib/capsium/package/metadata.rb', line 29 def save_to_file(output_path = @path) File.write(output_path, to_json) end |