Class: Ghundle::Metadata

Inherits:
Object
  • Object
show all
Defined in:
lib/ghundle/metadata.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#descriptionObject (readonly)

Returns the value of attribute description.



5
6
7
# File 'lib/ghundle/metadata.rb', line 5

def description
  @description
end

#typesObject (readonly)

Returns the value of attribute types.



5
6
7
# File 'lib/ghundle/metadata.rb', line 5

def types
  @types
end

#versionObject (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_hObject



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