Class: Jahuty::Resource::Factory
- Inherits:
-
Object
- Object
- Jahuty::Resource::Factory
- Defined in:
- lib/jahuty/resource/factory.rb
Overview
Instantiates and returns a resource.
Constant Summary collapse
Instance Method Summary collapse
Instance Method Details
#call(resource_name, payload) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/jahuty/resource/factory.rb', line 12 def call(resource_name, payload) klass = class_name(resource_name.to_sym) raise ArgumentError, "#{resource_name} missing" if klass.nil? Object.const_get(klass).send(:from, **payload) end |