M
Markus Gaelli
Hi List,
more questions from a Ruby-Newbie...
Sam Roberts from Ruby-Core answered to my original question:
That is good news to me. But now I wonder, if and how I can ask e.g.
String#this(opt) in which module it is defined.
Any ideas?
Cheers,
Markus
more questions from a Ruby-Newbie...
Sam Roberts from Ruby-Core answered to my original question:
This is probably best posted to ruby-talk, not ruby-core, folks would
likely be quite interested.
classes are "open" in ruby, you can add methods as you wish.
irb(main):001:0> s = "hi"
=> "hi"
irb(main):002:0> class String; def this(opt) puts(self+opt) end end
=> nil
irb(main):003:0> s.this(" that")
hi that
=> nil
irb(main):004:0> "bye".this(" that")
bye that
=> nil
Cheers,
Sam
That is good news to me. But now I wonder, if and how I can ask e.g.
String#this(opt) in which module it is defined.
Any ideas?
Cheers,
Markus