Class: Simp::Metadata::Buildinfo
- Inherits:
-
Object
- Object
- Simp::Metadata::Buildinfo
- Includes:
- Enumerable
- Defined in:
- lib/simp/metadata/buildinfo.rb
Instance Attribute Summary collapse
-
#component ⇒ Object
Returns the value of attribute component.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #[](index) ⇒ Object
- #build_method ⇒ Object
- #each ⇒ Object
- #fetch_data ⇒ Object
-
#initialize(component, type) ⇒ Buildinfo
constructor
A new instance of Buildinfo.
- #keys ⇒ Object
- #method_defaults ⇒ Object
Constructor Details
#initialize(component, type) ⇒ Buildinfo
Returns a new instance of Buildinfo.
8 9 10 11 |
# File 'lib/simp/metadata/buildinfo.rb', line 8 def initialize(component, type) @type = type @component = component end |
Instance Attribute Details
#component ⇒ Object
Returns the value of attribute component.
6 7 8 |
# File 'lib/simp/metadata/buildinfo.rb', line 6 def component @component end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/simp/metadata/buildinfo.rb', line 5 def type @type end |
Instance Method Details
#[](index) ⇒ Object
17 18 19 |
# File 'lib/simp/metadata/buildinfo.rb', line 17 def [](index) send index.to_sym end |
#build_method ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/simp/metadata/buildinfo.rb', line 39 def build_method buildinfo = fetch_data if buildinfo.nil? retval = method_defaults[type]['build_method'] else if buildinfo.key?(type) retval = if buildinfo[type].key?('build_method') buildinfo[type]['build_method'] else method_defaults[type]['build_method'] end else retval = method_defaults[type]['build_method'] end end retval end |
#each ⇒ Object
21 22 23 24 25 |
# File 'lib/simp/metadata/buildinfo.rb', line 21 def each keys.each do |key| yield key, self[key] end end |
#fetch_data ⇒ Object
27 28 29 |
# File 'lib/simp/metadata/buildinfo.rb', line 27 def fetch_data component.fetch_data('buildinfo') end |
#keys ⇒ Object
13 14 15 |
# File 'lib/simp/metadata/buildinfo.rb', line 13 def keys %w(type build_method) end |
#method_defaults ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/simp/metadata/buildinfo.rb', line 31 def method_defaults { 'rpm' => { 'build_method' => 'simp-core' } } end |