From: "David A. Black" Date: 2003-12-19T10:33:39+09:00 Subject: Re: overloading << operator Hi -- On Fri, 19 Dec 2003, Carl Youngblood wrote: > How do I create a class that will allow me to pass a string, for > example, to an instance of it using the << operator? Like this: > > #================================== > class Logger > include Singleton > .... > end > $logger = Logger.instance > .... > $logger << "Here is a log message" > #================================== << is just a method, so you can redefine it: class Logger def <<(s) # do something with s end end David -- David A. Black dblack@wobblini.net