提交 1244aa7c 编写于 作者: L Lauro Caetano

Use `public_send` instead of just use `send`.

上级 aa85bdba
......@@ -68,7 +68,7 @@ def #{method}(*args, &block)
RUBY
else
define_method method do |*args, &block|
scoping { @klass.send(method, *args, &block) }
scoping { @klass.public_send(method, *args, &block) }
end
end
end
......@@ -87,10 +87,10 @@ def delegate(method, opts = {})
def method_missing(method, *args, &block)
if @klass.respond_to?(method)
self.class.delegate_to_scoped_klass(method)
scoping { @klass.send(method, *args, &block) }
scoping { @klass.public_send(method, *args, &block) }
elsif arel.respond_to?(method)
self.class.delegate method, :to => :arel
arel.send(method, *args, &block)
arel.public_send(method, *args, &block)
else
super
end
......@@ -118,9 +118,9 @@ def respond_to?(method, include_private = false)
def method_missing(method, *args, &block)
if @klass.respond_to?(method)
scoping { @klass.send(method, *args, &block) }
scoping { @klass.public_send(method, *args, &block) }
elsif arel.respond_to?(method)
arel.send(method, *args, &block)
arel.public_send(method, *args, &block)
else
super
end
......
......@@ -10,15 +10,15 @@ def call_method(target, method)
method_arity = target.to_a.method(method).arity
if method_arity.zero?
target.send(method)
target.public_send(method)
elsif method_arity < 0
if method == :shuffle!
target.send(method)
target.public_send(method)
else
target.send(method, 1)
target.public_send(method, 1)
end
elsif method_arity == 1
target.send(method, 1)
target.public_send(method, 1)
else
raise NotImplementedError
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册