Class: Remap::Constructor
- Inherits:
-
Dry::Interface
- Object
- Dry::Interface
- Remap::Constructor
- Defined in:
- lib/remap/constructor.rb,
lib/remap/constructor/none.rb,
lib/remap/constructor/keyword.rb,
lib/remap/constructor/argument.rb
Defined Under Namespace
Classes: Argument, Keyword, None
Instance Method Summary collapse
-
#call(state) ⇒ State
Ensures #target responds to #method Returns an error state unless above is true.
- #id ⇒ Object
- #to_proc ⇒ Object
Instance Method Details
#call(state) ⇒ State
Ensures #target responds to #method Returns an error state unless above is true
14 15 16 17 18 19 20 |
# File 'lib/remap/constructor.rb', line 14 def call(state) state.tap do unless target.respond_to?(id) raise ArgumentError, "Target [#{target}] does not respond to [#{id}]" end end end |
#id ⇒ Object
22 23 24 |
# File 'lib/remap/constructor.rb', line 22 def id attributes.fetch(:method) end |
#to_proc ⇒ Object
26 27 28 |
# File 'lib/remap/constructor.rb', line 26 def to_proc method(:call).to_proc end |