Class: Resto::Translator::ResponseFactory

Inherits:
Factory
  • Object
show all
Defined in:
lib/resto/translator/response_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(klass, hash) ⇒ Object

Raises:

  • (ArgumentError)


8
9
10
11
12
13
# File 'lib/resto/translator/response_factory.rb', line 8

def call(klass, hash)
  hash ||= {}
  raise ArgumentError unless hash.is_a?(Hash)

  klass.new(traverse(hash, 0))
end