Class: Capsium::Package::Metadata
- Inherits:
-
Object
- Object
- Capsium::Package::Metadata
- Extended by:
- Forwardable
- Defined in:
- sig/capsium/package/metadata.rbs,
lib/capsium/package/metadata.rb
Overview
Loads and writes metadata.json; field access is delegated to the wrapped MetadataData config (ARCHITECTURE.md section 2).
Instance Attribute Summary collapse
-
#config ⇒ MetadataData
readonly
Returns the value of attribute config.
-
#path ⇒ String
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #author ⇒ String?
- #dependencies ⇒ Hash[String, String]
- #description ⇒ String?
- #guid ⇒ String?
-
#initialize(path) ⇒ Metadata
constructor
A new instance of Metadata.
- #license ⇒ String?
- #name ⇒ String?
- #repository ⇒ Repository?
- #save_to_file(output_path = @path) ⇒ void
- #to_hash ⇒ Hash[String, untyped]
- #to_json ⇒ String
- #uuid ⇒ String?
- #version ⇒ String?
Constructor Details
#initialize(path) ⇒ Metadata
Returns a new instance of Metadata.
16 17 18 19 20 21 22 23 |
# File 'lib/capsium/package/metadata.rb', line 16 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 ⇒ MetadataData (readonly)
Returns the value of attribute config.
8 9 10 |
# File 'lib/capsium/package/metadata.rb', line 8 def config @config end |
#path ⇒ String (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/capsium/package/metadata.rb', line 8 def path @path end |
Instance Method Details
#author ⇒ String?
20 |
# File 'sig/capsium/package/metadata.rbs', line 20
def author: () -> String?
|
#dependencies ⇒ Hash[String, String]
23 |
# File 'sig/capsium/package/metadata.rbs', line 23
def dependencies: () -> Hash[String, String]
|
#description ⇒ String?
17 |
# File 'sig/capsium/package/metadata.rbs', line 17
def description: () -> String?
|
#guid ⇒ String?
18 |
# File 'sig/capsium/package/metadata.rbs', line 18
def guid: () -> String?
|
#license ⇒ String?
21 |
# File 'sig/capsium/package/metadata.rbs', line 21
def license: () -> String?
|
#name ⇒ String?
15 |
# File 'sig/capsium/package/metadata.rbs', line 15
def name: () -> String?
|
#repository ⇒ Repository?
22 |
# File 'sig/capsium/package/metadata.rbs', line 22
def repository: () -> Repository?
|
#save_to_file(output_path = @path) ⇒ void
This method returns an undefined value.
25 26 27 |
# File 'lib/capsium/package/metadata.rb', line 25 def save_to_file(output_path = @path) File.write(output_path, to_json) end |
#to_hash ⇒ Hash[String, untyped]
14 |
# File 'sig/capsium/package/metadata.rbs', line 14
def to_hash: () -> Hash[String, untyped]
|
#to_json ⇒ String
13 |
# File 'sig/capsium/package/metadata.rbs', line 13
def to_json: (*untyped args) -> String
|
#uuid ⇒ String?
19 |
# File 'sig/capsium/package/metadata.rbs', line 19
def uuid: () -> String?
|
#version ⇒ String?
16 |
# File 'sig/capsium/package/metadata.rbs', line 16
def version: () -> String?
|