set hash in define_method