class TryUntil::Probe

This PORO holds information about a target object against which to call a specified method with specified arguments

Public Class Methods

new(target, method, args = []) click to toggle source

Example: Probe.new(SomeClass.new, :some_method, [arg1, arg2, …])

# File lib/try_until/probe.rb, line 7
def initialize(target, method, args = [])
  @target = target
  @method = method
  @args = args
end

Public Instance Methods

sample() click to toggle source
# 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() click to toggle source
# File lib/try_until/probe.rb, line 21
def to_s
  "Probe: #{@target.class}##{@method}(#{@args})"
end

Private Instance Methods

args_is_one_hash?() click to toggle source
# File lib/try_until/probe.rb, line 26
def args_is_one_hash?
  @args.class == Hash
end