From: Trans Date: 2005-12-04T13:42:33+09:00 Subject: Re: injecting dynamic methods into a class If you don't mind while I'm at this I'm going to touch up the code to follow ruby conventions. def initialize( attr_and_sizes_hash, consumer_class ) attr_and_sizes_hash.each {|attr_name, max_size| code = %{ def #{attr_name}=( file ) write_attribute( '#{attr_name}', ImageBlob.getBlob( file, #{max_size} ) ) end } consumer_class.class_eval code end BTW it seems odd to use the #initialize method of ImageBob to do this. HTH, T.