Actions
Bug #9452
closedRefining methods that should be private
Description
Are refinements also meant to add private methods? This is what I tried:
module R
refine Object do
def m
puts "Success!"
end
private(:m)
end
end
using R
m # success
42.m # success (= not private)
However, I can get near the desired functionality by defining a private method first:
class Object
private
def m
end
end
module R
refine Object do
def m
puts "Success!"
end
end
end
using R
m # success
42.m # no success (= it is private)
It calls the right code. But requires global core ext.
Actions
Like0
Like0Like0Like0Like0Like0