[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Valid name for a method

German Monfort

4/28/2007 6:48:00 PM

Hi all,

I'm trying to add a new method to a class but I want to name it like `<<<' or
`++', etc but it seems that these characters are not allowed

irb(main):001:0> class A
irb(main):002:1> def <<< arg
irb(main):003:2> end
irb(main):004:1> end
SyntaxError: compile error
(irb):2: syntax error, unexpected '<', expecting '\n' or ';'
def <<< arg
^
(irb):4: syntax error, unexpected kEND, expecting $end
from (irb):4
from :0

Is there a workaround to have a `<<<' method so I can use it like a <<< b or
even a.<<< b?


1 Answer

Ara.T.Howard

4/28/2007 7:11:00 PM

0