Love U Ruby wrote in post #1120864:> I am confused on the second call :-
>
> class Foo
> def <<(param)
> "hi"
> end
> end
> foo = Foo.new
> foo.<<(1) # => "hi"
>
> foo << 1 # => "hi" # I didn''t use `.`
method,then how method `<<` has
> been called?
I would image that it works the same as it does for the +, -, *, and /
methods.
Example:
$ irb
irb(main):001:0> 5 + 7
=> 12
irb(main):002:0> 5.+(7)
=> 12
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit
https://groups.google.com/d/msgid/rubyonrails-talk/033bdc692487eb5166b61f1c7ee05fe5%40ruby-forum.com.
For more options, visit https://groups.google.com/groups/opt_out.