From: Ara.T.Howard@... Date: 2004-09-29T07:24:24+09:00 Subject: Re: Best name for "this method" ? --8323328-2024097184-1096409935=:1405 Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-2024097184-1096409935=:1405" This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-2024097184-1096409935=:1405 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Wed, 29 Sep 2004, trans. (T. Onoma) wrote: > On Tuesday 28 September 2004 05:44 am, Gavin Sinclair wrote: >> =C2=A0 foo.methods[:new, :protected] =C2=A0 # if you need combination > > This line's got me thinking... How does one define a class [] constructor= ? For > example Hash can be use like this: > > Hash[:a=3D>1,:b=3D>2 ] class << self; alias [] new; end > > And then I start to wonder why we can't just use the class name like a me= thod? > > Hash(:a=3D>1, :b=3D>2) probably possible: irb(main):029:0> def method_missing(m,*a,&b);Class =3D=3D=3D (c =3D ev= al(m.to_s)) ? c::new(*a,&b) : super;end =3D> nil irb(main):030:0> Range(1,2) =3D> 1..2 ?? -a -- =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | A flower falls, even though we love it; | and a weed grows, even though we do not love it.=20 | --Dogen =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D --8323328-2024097184-1096409935=:1405-- --8323328-2024097184-1096409935=:1405--