Don't the Ruby methods instance_eval() and send() negate the benefits of private visibility?

后端 未结 5 917
误落风尘
误落风尘 2021-01-21 12:45
w = Widget.new # Create a Widget
w.send :utility_method # Invoke private method!
w.instance_eval { utility_method } # Another way to invoke it
w.instance_eval { @x } # R         


        
5条回答
提交回复
热议问题