Class: Samsa::Mapper

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

Defined Under Namespace

Classes: InvalidTransformType, Transform

Instance Method Summary collapse

Constructor Details

#initialize(template, input) ⇒ Mapper

Returns a new instance of Mapper.



5
6
7
8
# File 'lib/samsa/mapper.rb', line 5

def initialize(template, input)
  @template = template
  @input = input
end

Instance Method Details

#normalizeObject



10
11
12
13
14
# File 'lib/samsa/mapper.rb', line 10

def normalize
  @template.inject({}) do |memo, transform|
    Transform.build(transform).apply(@input, memo)
  end
end