work around absence of define_method at top level in ruby 1.9