Actions
Feature #15326
closedProposal: Enable refinements to `#public_send`
Status:
Closed
Assignee:
-
Target version:
-
Description
Sometimes we use #public_send
rather than #send
to avoid calling the private
method.
def meth(a)
# Not call private method
# Use #public_send
a.public_send(a.name)
end
However, #send
support to refinements, but #public_send
does not support refinements.
class X
def name
"hoge"
end
end
module Ex
refine X do
def hoge
# ...
end
end
end
using Ex
def meth(a)
# Not call private method
# Use #public_send
a.public_send(a.name)
end
# Error: undefined method `hoge' for #<X:0x0000561a8cc7e280> (NoMethodError)
meth X.new
#public_send
also wants to support refinements.
pull request : https://github.com/ruby/ruby/pull/2019
Updated by nobu (Nobuyoshi Nakada) almost 6 years ago
- Status changed from Open to Closed
Applied in changeset trunk|r65919.
Enable refinements to public_send.
[Feature #15326] [Fix GH-2019]
From: manga_osyo manga.osyo@gmail.com
Actions
Like0
Like0