Created
September 4, 2008 17:52
-
-
Save neerajsingh0101/8825 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Foo | |
def self.included(base) | |
base.class_eval do | |
extend ClassMethods | |
include InstanceMethods | |
end | |
end | |
module ClassMethods | |
def c | |
puts 'i am class method' | |
puts self | |
p = self.new | |
p.i | |
end | |
end | |
module InstanceMethods | |
def i | |
puts ' i am instance method' | |
end | |
end | |
end | |
class Person | |
include Foo | |
end | |
Person.c | |
# Person.new.i |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment