Class: Remap::Constructor::Argument

Inherits:
Concrete
  • Object
show all
Defined in:
lib/remap/constructor/argument.rb

Instance Method Summary collapse

Instance Method Details

#call(state) ⇒ State

Uses the #method method to initialize #target with state Target is only called if state is defined

Fails if #target does not respond to #method Fails if #target cannot be called with state

Parameters:

Returns:



19
20
21
22
23
24
25
# File 'lib/remap/constructor/argument.rb', line 19

def call(state)
  super.fmap do |input|
    target.public_send(id, input)
  rescue ArgumentError => e
    raise e.exception("Could not load target [#{target}] using the argument strategy with [#{input}] (#{input.class})")
  end
end