Skip to content

@krainboltgreene /1st.rb
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
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
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
@krainboltgreene

~/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]
[]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.