Class: Remap::Constructor::Keyword
- Inherits:
-
Concrete
- Object
- Concrete
- Remap::Constructor::Keyword
- Defined in:
- lib/remap/constructor/keyword.rb
Instance Method Summary collapse
-
#call(state) ⇒ State
Calls #target as with keyword arguments.
Instance Method Details
#call(state) ⇒ State
Calls #target as with keyword arguments
Fails if #target does not respond to #method Fails if #target cannot be called with state
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/remap/constructor/keyword.rb', line 18 def call(state) super.fmap do |input, &error| unless input.is_a?(Hash) return error["Input is not a hash"] end target.public_send(id, **input) rescue ArgumentError => e raise e.exception("Could not load target [#{target}] using the keyword strategy using [#{input}] (#{input.class})") end end |