summaryrefslogtreecommitdiff
path: root/lib/forwardable.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-23 06:47:06 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-09-23 06:47:06 +0000
commitef13e60fe07766549275c19f3e5112fb7773cf38 ()
treefa4a15f86b7ea3b7e8ecfd4942d831919e59b3e0 /lib/forwardable.rb
parent1e1a114c256686be6b65793699c0e43d9fc8c84b (diff)
forwardable.rb: private methods
* lib/forwardable.rb (_delegator_method): allow private methods to be delegated, with warnings. [ruby-core:77341] [Bug #12782] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56210 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--lib/forwardable.rb37
1 files changed, 24 insertions, 13 deletions
@@ -195,31 +195,42 @@ module Forwardable
accessor = "#{accessor}()"
end
- unless begin
- iseq = RubyVM::InstructionSequence
- .compile("().#{method}", nil, nil, 0, false)
- rescue SyntaxError
- else
- iseq.to_a.dig(-1, 1, 1, :mid) == method.to_sym
- end
- method_call = "__send__(:#{method}, *args, &block)"
- else
- method_call = "#{method}(*args, &block)"
end
line_no = __LINE__+1; str = "#{<<-"begin;"}\n#{<<-"end;"}"
begin;
proc do
def #{ali}(*args, &block)
begin
#{accessor}
- end.#{method_call}
end
end
end;
- RubyVM::InstructionSequence
- .compile(str, __FILE__, __FILE__, line_no,
trace_instruction: false,
tailcall_optimization: true)
.eval