Afficher un message
Vieux 21/02/2008, 13h55   #1
Stephane Wirtel
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut How to define the assignment operator in Ruby ?

Hi all,

How to define the assignment operator for a class ?

irb(main):012:0> class Test
irb(main):013:1> def = other
irb(main):014:2> puts other.class
irb(main):015:2> end
irb(main):016:1> end
SyntaxError: compile error
(irb):13: syntax error, unexpected '='
def = other
^
(irb):16: syntax error, unexpected kEND, expecting $end from (irb):16

Is there a way to solve my issue ?

Where is my mistake ?

I don't believe that's possible to assign something to an instance

Best Regards,

Stephane
  Réponse avec citation
 
Page generated in 0,05493 seconds with 9 queries