Class: Chemtrail::Mapping
- Inherits:
-
Object
- Object
- Chemtrail::Mapping
- Defined in:
- lib/chemtrail/mapping.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #entries ⇒ Object
- #find(top_level, second_level) ⇒ Object
-
#initialize(id, entries = nil) ⇒ Mapping
constructor
A new instance of Mapping.
- #to_hash ⇒ Object
Constructor Details
#initialize(id, entries = nil) ⇒ Mapping
Returns a new instance of Mapping.
6 7 8 9 |
# File 'lib/chemtrail/mapping.rb', line 6 def initialize(id, entries = nil) @id = id @entries = entries end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/chemtrail/mapping.rb', line 4 def id @id end |
Instance Method Details
#entries ⇒ Object
11 12 13 |
# File 'lib/chemtrail/mapping.rb', line 11 def entries @entries ||= {} end |
#find(top_level, second_level) ⇒ Object
15 16 17 |
# File 'lib/chemtrail/mapping.rb', line 15 def find(top_level, second_level) Chemtrail::Function.new("Fn::FindInMap", id, top_level, second_level).to_hash end |
#to_hash ⇒ Object
19 20 21 22 23 |
# File 'lib/chemtrail/mapping.rb', line 19 def to_hash { id => entries } end |