In article 04af01c299e6$e35ebdc0$d44532d2@nosedog , Gavin
Sinclair
wrote:
[…]
<<
- Appends an Array or String in place.
a = [1,2,3]
a << 4 # a == [1,2,3,4]
It would be nice if you mentioned that in this case << is just a
method which people can define on their own classes.
IMO, this “<<” definitely belongs with the other bit-operators,
because they are overloadable methods as well. There are a couple of
places in Ruby where “>>” has also been defined, IIRC.
-austin
– Austin Ziegler, austin@halostatue.ca on 2002.12.03 at 07.47.39
···
On Tue, 3 Dec 2002 16:31:26 +0900, Tim Sutherland wrote:
IMO, since << is encountered far more often in code examples than the
other bit operators, giving it a special place is warranted within this
particular FAQ.
martin
···
Austin Ziegler austin@halostatue.ca wrote:
On Tue, 3 Dec 2002 16:31:26 +0900, Tim Sutherland wrote:
In article 04af01c299e6$e35ebdc0$d44532d2@nosedog , Gavin
Sinclair
wrote:
[…]
<<
- Appends an Array or String in place.
a = [1,2,3]
a << 4 # a == [1,2,3,4]
It would be nice if you mentioned that in this case << is just a
method which people can define on their own classes.
IMO, this “<<” definitely belongs with the other bit-operators,
because they are overloadable methods as well. There are a couple of
places in Ruby where “>>” has also been defined, IIRC.