From: Martin DeMello Date: 2002-12-02T18:08:12+09:00 Subject: Re: [FAQ] [Revised again] What are the non-alphanumerical symbols in Ruby code? Gavin Sinclair wrote: > ~ << >> & ^ | > > 1. "<<" most often means that a "here" document follows, e.g.: > > puts < This is a here document. > EOS > > 2. "<<" also creates a new class based on a particular object. > These object-specific classes are called 'singleton classes'. > In the example below, only the Car object referred to by > "camaro" will have the method "has_flames?". > > camaro = Car.new > class << camaro > def has_flames? > true > end > end 4. "<<" is also the operator for appending to an array/string in place a = [1,2,3] a += [4,5] # Creates a new array object and assigns it to a a << [4,5] # appends [4,5] directly to the array object a points # to (personally, I use that even more than I do here documents) > . ... And that should be '..' where you have '.' martin