Class: HashTemplate

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mapping) ⇒ HashTemplate

Returns a new instance of HashTemplate.



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

def initialize(mapping)
  @mapping = mapping
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



2
3
4
# File 'lib/hash_template.rb', line 2

def data
  @data
end

#mappingObject (readonly)

Returns the value of attribute mapping.



2
3
4
# File 'lib/hash_template.rb', line 2

def mapping
  @mapping
end

Instance Method Details

#map(data) ⇒ Object



8
9
10
11
# File 'lib/hash_template.rb', line 8

def map(data)
  @data = data
  deep_map mapping
end