class S4tUtils::ArgForwarder

An ArgForwarder is associated with a target. It forwards messages sent to it to the target, passing along any arguments to the method. So far, so boring. But an ArgForwarder is also created with some added_args. When the ArgForwarder forwards, it prepends those added_args to the message’s given arguments.

array = []
forwarder = ArgForwarder.new(array, 5)
forwarder.push
assert_equal([5], array)

Public Class Methods

new(target, *added_args) click to toggle source
# File lib/s4t-utils/hacks.rb, line 47
def initialize(target, *added_args)
  @target = target
  @added_args = added_args
end