Class: Chemtrail::Mapping

Inherits:
Object
  • Object
show all
Defined in:
lib/chemtrail/mapping.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ Mapping

Returns a new instance of Mapping.



6
7
8
# File 'lib/chemtrail/mapping.rb', line 6

def initialize(id)
  @id = id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/chemtrail/mapping.rb', line 4

def id
  @id
end

Instance Method Details

#entriesObject



10
11
12
# File 'lib/chemtrail/mapping.rb', line 10

def entries
  @entries ||= {}
end

#find(top_level, second_level) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/chemtrail/mapping.rb', line 14

def find(top_level, second_level)
  {
    "Fn::FindInMap" => [
      id,
      Chemtrail::ReferencePresenter.new(top_level).to_parameter,
      Chemtrail::ReferencePresenter.new(second_level).to_parameter
    ]
  }
end

#to_hashObject



24
25
26
27
28
# File 'lib/chemtrail/mapping.rb', line 24

def to_hash
  {
    id => entries
  }
end