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 ExampleModule | |
def amethod | |
end | |
end | |
class AClass | |
end | |
apre_imethods = AClass.instance_methods | |
apre_smethods = AClass.singleton_methods | |
class AClass | |
include ExampleModule | |
extend ExampleModule | |
end | |
p AClass.instance_methods - apre_imethods | |
p AClass.singleton_methods - apre_smethods | |
class BClass | |
end | |
bpre_imethods = BClass.instance_methods | |
bpre_smethods = BClass.singleton_methods | |
class BClass | |
extend ExampleModule | |
include ExampleModule | |
end | |
p BClass.instance_methods - bpre_imethods | |
p BClass.singleton_methods - bpre_smethods | |
opre_imethods = Object.instance_methods | |
opre_smethods = Object.singleton_methods | |
class Object | |
include ExampleModule | |
extend ExampleModule | |
end | |
p Object.instance_methods - opre_imethods | |
p Object.singleton_methods - opre_smethods |
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 ExampleModule | |
def amethod | |
end | |
end | |
class AClass | |
end | |
apre_imethods = AClass.instance_methods | |
apre_smethods = AClass.singleton_methods | |
class AClass | |
include ExampleModule | |
extend ExampleModule | |
end | |
p AClass.instance_methods - apre_imethods | |
p AClass.singleton_methods - apre_smethods | |
class BClass | |
end | |
bpre_imethods = BClass.instance_methods | |
bpre_smethods = BClass.singleton_methods | |
class BClass | |
extend ExampleModule | |
include ExampleModule | |
end | |
p BClass.instance_methods - bpre_imethods | |
p BClass.singleton_methods - bpre_smethods | |
opre_imethods = Object.instance_methods | |
opre_smethods = Object.singleton_methods | |
class Object | |
extend ExampleModule | |
include ExampleModule | |
end | |
p Object.instance_methods - opre_imethods | |
p Object.singleton_methods - opre_smethods |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
~/Repositories ‹ruby-1.9.3› $ ruby exin.rb
[:amethod]
[:amethod]
[:amethod]
[:amethod]
[:amethod]
[:amethod]
~/Repositories ‹ruby-1.9.3› $ ruby inex.rb
[:amethod]
[:amethod]
[:amethod]
[:amethod]
[:amethod]
[]