Does anyone know in which class/module the = method is in Ruby?
I want to convert
a = b
into
a equals b
So I have to know in which class/module it is so I can make an alias.
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
=is the assignment operator. It can not be redefined.Moreover, you can not define new operators. As Jörg points out,
a equals bis the same asa(equals(b))or equivalentlyself.a(self.equals(b)), so, you’d need an object that responds to both the:amessage and the:equalsmessage.