Class: CloudFormatter::Mappings

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/cloud_formatter/mappings.rb

Instance Method Summary collapse

Constructor Details

#initializeMappings

Returns a new instance of Mappings


6
7
8
# File 'lib/cloud_formatter/mappings.rb', line 6

def initialize
  @maps = {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(map_name, values) ⇒ Object


18
19
20
# File 'lib/cloud_formatter/mappings.rb', line 18

def method_missing(map_name, values)
  @maps[map_name.to_s] = values
end

Instance Method Details

#to_json_dataObject


10
11
12
13
14
15
16
# File 'lib/cloud_formatter/mappings.rb', line 10

def to_json_data
  json = {}
  @maps.each do |key, value|
    json[DSL.format(key)] = value
  end
  json
end