Class: Ghundle::Metadata
- Inherits:
-
Object
- Object
- Ghundle::Metadata
- Defined in:
- lib/ghundle/metadata.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#types ⇒ Object
readonly
Returns the value of attribute types.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(data = {}) ⇒ Metadata
constructor
A new instance of Metadata.
- #to_h ⇒ Object
Constructor Details
#initialize(data = {}) ⇒ Metadata
Returns a new instance of Metadata.
11 12 13 14 15 |
# File 'lib/ghundle/metadata.rb', line 11 def initialize(data = {}) @version = HookVersion.new(data['version']) @types = data['types'] @description = data['description'] end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
5 6 7 |
# File 'lib/ghundle/metadata.rb', line 5 def description @description end |
#types ⇒ Object (readonly)
Returns the value of attribute types.
5 6 7 |
# File 'lib/ghundle/metadata.rb', line 5 def types @types end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
5 6 7 |
# File 'lib/ghundle/metadata.rb', line 5 def version @version end |
Class Method Details
.from_yaml(filename) ⇒ Object
7 8 9 |
# File 'lib/ghundle/metadata.rb', line 7 def self.from_yaml(filename) new(YAML.load_file(filename)) end |
Instance Method Details
#to_h ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/ghundle/metadata.rb', line 17 def to_h { 'types' => types, 'version' => version.to_s, 'description' => description, } end |