> I didn't really have a problem in mind, but here's an easy one: Write an []=
> method to solve the following:
>
> obj = YourClass.new
> obj['answer'] = 42
> obj.answer  => 42


I'm no metaprogramming wizard... I keep trying variations until it
works.  :D  This seems to work.

class YourClass
  def []=(f, v)
    class << self; self end.instance_eval{ attr_accessor f };
instance_eval "@#{f}=v"
  end
end