Replace metaclass method with the built-in define_singleton_method
Add example to make sure locals are added as singleton methods