Skip to content

Instantly share code, notes, and snippets.

@dinks
Created December 2, 2013 15:55
Show Gist options
  • Select an option

  • Save dinks/7751631 to your computer and use it in GitHub Desktop.

Select an option

Save dinks/7751631 to your computer and use it in GitHub Desktop.
Define Singleton Method
# From https://github.com/marcandre/backports
unless Kernel.method_defined? :define_singleton_method
module Kernel
def define_singleton_method(*args, &block)
class << self
self
end.send(:define_method, *args, &block)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment