On Mar 11, 10:23 am, ara.t.how... / noaa.gov wrote:
> On Sun, 11 Mar 2007, Thomas Hafner wrote:
> > Hello,
>
> > is there a way to get an object, if only its object-specific class is
> > given? For instance, given
>
> >  c = class << Hash[:a, 5]
> >    def mult(x)
> >      self[:a] * x
> >    end
> >    self
> >  end
>
> > can I retrieve the hash object via evaluation of c?
>
>    harp:~ > cat a.rb
>    c = class << Hash[:a, 5]
>      def mult(x)
>        self[:a] * x
>      end
>      self
>    end
>
>    p c.instance_eval{ self }
>
>    harp:~ > ruby a.rb
>    #<Class:#<Hash:0xb75cfd18>>

I thought we wanted the result to be #<Hash:0xb75cfd18>?

T.