You seem to rely on the syntactic sugar that is given to method * for many things.
If you write your method * and use it implicitly . , to indicate that this message is to the recipient, you may be lucky.
For example, when I do this with Fixnum
class Fixnum def * "This is the modified star" end end
When I try to do this in IRB
>> 1 * 1 ArgumentError: wrong number of arguments (1 for 0)
I would also have a normal problem if it recognized * , if I just hit enter ... he would expect more input on the next line ...
However, if I do this:
>> 1.* => ""This is the modified star"
So the point is not that it is impossible to do, you can simply fight the syntactic sugar that develops around this particular symbol.
Consider a private method that you can do, but you will have difficulty using the eval call family. You could do this:
some_instance.send(:*)
If, of course, an argument is needed, we can do some_instance.send(:*, argument)
vgoff source share