Class: Resto::Translator::RequestFactory

Inherits:
Factory
  • Object
show all
Defined in:
lib/resto/translator/request_factory.rb

Instance Method Summary collapse

Methods inherited from Factory

create, #initialize

Constructor Details

This class inherits a constructor from Resto::Translator::Factory

Instance Method Details

#call(attributes) ⇒ Object

Raises:

  • (ArgumentError)


33
34
35
36
37
38
39
40
# File 'lib/resto/translator/request_factory.rb', line 33

def call(attributes)
  attributes ||= {}
  raise ArgumentError unless attributes.is_a?(Hash)

  @keys.reverse.inject(attributes) do |memo, item|
    Hash.new.tap {|h| h[item] = memo }
  end
end