Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ruby Module pattern
module NameSpace
module MyClass
def self.included(host_class)
host_class.instance_eval do
has_one :thing
attr_accessible :something
validate :foo
extend ClassMethods
include InstanceMethods
private :something
after_initialize do
puts "hi"
end
end
end
module InstanceMethods
def foo
true
end
end
module ClassMethods
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.