module Kernel # From the backports gem # Standard in ruby 1.9. See official documentation[http://ruby-doc.org/core-1.9/classes/Object.html] def define_singleton_method(*args, &block) class << self self end.send(:define_method, *args, &block) end unless method_defined? :define_singleton_method end