On Nov 29, 10:16 pm, "Paul McMahon" <p... / ubit.com> wrote:
> On Fri, 30 Nov 2007 12:06:18 +0900, Trans <transf... / gmail.com> wrote:
> > i have one for you, since were throw'n them out. i wish "@" was a
> > hash.
>
> >   x = "a"
> >   @[x] = 1
>
> >   @a  #=> 1
>
> >   @.each do |k,v|
> >     "just another instance var #{k} = #{v}"
> >   end
>
> >   #=> just another instance var a = 1
>
> > T.
>
> You can already do that
> irb(main):001:0>  @a = 1
> => 1
> irb(main):002:0> instance_variables.each do |k|
> irb(main):003:1*  v = instance_variable_get(k)
> irb(main):004:1>  puts "just another instance var #{k} = #{v}"
> irb(main):005:1> end
> just another instance var @a = 1
> => ["@a"]

Really? That's amazing! ;)

T.