trans. (T. Onoma) wrote:

> Sure. Okay first, basically what I was doing, given object o and data in hash 
> h:
> 
>     h.each do |k,v|
>       o.instance_variable_set("@#{k}", v)
>       o.instance_eval <<-EOS
>         def #{k}; @#{k}; end 
>         def #{k}=(x); @#{k}=x; end
>       EOS
>     end

h.each do |k,v|
   class << o; self; end.send(:attr_accessor, k)
   o.k = v
end

Maybe .meta_class and .meta_class_eval should really be part of Standard 
Ruby...