Skip to content

Instantly share code, notes, and snippets.

@a-bash
Created October 3, 2012 19:58
Show Gist options
  • Save a-bash/3829457 to your computer and use it in GitHub Desktop.
Save a-bash/3829457 to your computer and use it in GitHub Desktop.
Ruby Clean Module Definition
module TagLib
module ClassMethods
def find_by_tags()
# ...
end
end
module InstanceMethods
def tags()
# ...
end
end
def self.included(base)
base.send :include, InstanceMethods
base.send :extend, ClassMethods
end
end
class ActiveRecord::Base
include TagLib
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment