Ruby Developer Question:
Download Questions PDF

Tell me can you call a private method outside a Ruby class using its object?


Yes, with the help of the send method.

Given the class Test:

class Test
def method
p "I am a private method"
We can execute the private method using send:

"I am a private method"

Download Ruby Developer Interview Questions And Answers PDF

Previous QuestionNext Question
Tell us what is class libraries in Ruby?Explain me what is the function of ORM in Ruby on Rails?