From: "Mauricio Fernández" Date: 2004-02-19T04:50:41+09:00 Subject: Re: Builtins RDoc tarball? On Thu, Feb 19, 2004 at 02:23:02AM +0900, Gavin Kistner wrote: > For example, I have: > > # Can be called in one of five ways: > # * MutableTime.new( ) -- same as #now > # * MutableTime.new( someString ) -- same as #parse > # * MutableTime.new( someSeconds ) -- same as #at > # * MutableTime.new( year, month, ... ) -- same as #local > # * MutableTime.new( aTimeOrMutableTime ) -- creates a new > MutableTime based off of > # the supplied Time or MutableTime object > > def initialize( dateString_Seconds_Time_orYear = nil , *dateTimePieces ) > This is commonly solved with several 'constructors' class << self def new_from_string(string); ... new(...) end def new_from_seconds(seconds); ... end ... end -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com Linux: Where Don't We Want To Go Today? -- Submitted by Pancrazio De Mauro, paraphrasing some well-known sales talk