Skip to content

Instantly share code, notes, and snippets.

@shouichi
Created January 14, 2011 08:53
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 shouichi/779376 to your computer and use it in GitHub Desktop.
Save shouichi/779376 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
module Teacher
def self.included(model)
model.instance_eval do
extend ClassMethods
include InstanceMethods
end
end
module ClassMethods
def a_class_method
"A class method"
end
end
module InstanceMethods
def a_instance_method
"An instance method"
end
end
end
class Person
include Teacher
end
p Person.a_class_method
p Person.new.a_instance_method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment