Power of Object#send()
class Foo
private
def fooprivate
puts "Test Private"
end
end
</pre>
</code>
So now if do
object = Foo.new
object.fooprivate
</code>
We all know it will throw error
private method `foo_private' called for #Foo:0x007ff562084b48 (NoMethodError)
</pre></code>
Now call it in send
object.send(:foo_private) => # "Test Private"
Written by Rashmi
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#