Class: Remap::Constructor
- Inherits:
-
Dry::Interface
- Object
- Dry::Interface
- Remap::Constructor
show all
- 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
Instance Method Details
#call(state) ⇒ State
Ensures #target responds to #method Returns an error state unless above is true
17
18
19
20
21
22
23
|
# File 'lib/remap/constructor.rb', line 17
def call(state)
state.tap do
unless target.respond_to?(id)
raise ArgumentError, "Target [#{target}] does not respond to [#{id}]"
end
end
end
|
#method ⇒ Symbol
9
|
# File 'lib/remap/constructor.rb', line 9
attribute :method, Symbol, default: :new
|
#target ⇒ Any
6
|
# File 'lib/remap/constructor.rb', line 6
attribute :target, Types::Any, not_eql: Nothing
|
#to_proc ⇒ Proc
26
27
28
|
# File 'lib/remap/constructor.rb', line 26
def to_proc
method(:call).to_proc
end
|