Skip to content

Instantly share code, notes, and snippets.

@tsevdos
Last active February 1, 2016 18:59
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 tsevdos/7d5f4e2c9b592cb7d0d2 to your computer and use it in GitHub Desktop.
Save tsevdos/7d5f4e2c9b592cb7d0d2 to your computer and use it in GitHub Desktop.
Extending Class methods with Module Mixins
# module
module Findable
def find_by_name(name)
# find something
end
end
# Class
class Klass
# class stuff
class << self
include Findable
end
end
Klass.find_by_name('John')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment