Class: TryUntil::Probe
- Inherits:
-
Object
- Object
- TryUntil::Probe
- Defined in:
- lib/try_until/probe.rb
Overview
This PORO holds information about a target object against which to call a specified method with specified arguments
Instance Method Summary collapse
-
#initialize(target, method, args = []) ⇒ Probe
constructor
Example: Probe.new(SomeClass.new, :some_method, [arg1, arg2, …]).
- #sample ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(target, method, args = []) ⇒ Probe
Example: Probe.new(SomeClass.new, :some_method, [arg1, arg2, …])
7 8 9 10 11 |
# File 'lib/try_until/probe.rb', line 7 def initialize(target, method, args = []) @target = target @method = method @args = args end |
Instance Method Details
#sample ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/try_until/probe.rb', line 13 def sample if args_is_one_hash? @target.send(@method, @args) else @target.send(@method, *@args) end end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/try_until/probe.rb', line 21 def to_s "Probe: #{@target.class}##{@method}(#{@args})" end |