summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
-rw-r--r--lib/forwardable.rb12
1 files changed, 10 insertions, 2 deletions
@@ -178,6 +178,10 @@ module Forwardable
# q.push 23 #=> NoMethodError
#
def def_instance_delegator(accessor, method, ali = method)
line_no = __LINE__; str = %{
def #{ali}(*args, &block)
begin
@@ -270,7 +274,11 @@ module SingleForwardable
# the method of the same name in _accessor_). If _new_name_ is
# provided, it is used as the name for the delegate method.
def def_single_delegator(accessor, method, ali = method)
- str = %{
def #{ali}(*args, &block)
begin
#{accessor}.__send__(:#{method}, *args, &block)
@@ -281,7 +289,7 @@ module SingleForwardable
end
}
- instance_eval(str, __FILE__, __LINE__)
end
alias delegate single_delegate