module Sandbox
def self.add_attributes(klass, *attrs)
def self.add_attributes(klass, *attrs) self.const_get_from_string(klass).class_eval do attr_accessor *attrs # set up the 'initialize' method to assign the attributes define_method(:initialize) do |value_hash={}| attrs.each_with_index do |attr| instance_variable_set("@#{attr}", value_hash[attr.to_sym]) end end end end