Skip to content

Instantly share code, notes, and snippets.

@foca
Created September 14, 2010 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save foca/579194 to your computer and use it in GitHub Desktop.
Save foca/579194 to your computer and use it in GitHub Desktop.
Adding class methods from a module, that are added to the class hierarchy (so you can use super, unlike with Module#extend)
module Foo
def find(*)
"Foo#find"
end
end
class Blah
class << self
include Foo
end
def self.find(*)
"Blah.find -- #{super}"
end
end
Blah.find #=> "Blah.find -- Foo#find"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment