Try Ruby's define_method for similar method generation