Gavin Kistner
6/28/2007 7:52:00 PM
On Jun 28, 1:46 pm, Vincent Predoehl <vpredo...@phoenixwebgroup.com>
wrote:
> I thought I knew everything about the Ruby syntax, then I saw this:
>
> (doc/"#sidebar").remove
>
> What does the slash do, is it an operator? What's it called?
It's a method call, as with most other 'operators'.
irb(main):001:0> 10 / 2
=> 5
irb(main):002:0> class Fixnum; def /(*a); puts "Ha ha!"; end; end
=> nil
irb(main):003:0> 10 / 2
Ha ha!
=> nil
(Note how it doesn't even return the right value anymore!)