This does not seem to work:
class Test
private
define_method :private_method do
\"uh!\"
end
end
puts Test.new.private_method
Module#private takes an optional argument for the method name:
class Test
private :private_method
end
The above is of course equivalent to
Test.private :private_method # doesn't work
Except that Module#private is private, so you have to use reflection to circumvent the access restrictions:
Test.send :private, :private_method
No eval necessary.