fix for backwards compatibility with ruby 186

cannot use define_method with a block