Skip to content

Instantly share code, notes, and snippets.

@adaedra
Created October 18, 2015 21:37
Show Gist options
  • Save adaedra/5854e1ec31b4794dbfd1 to your computer and use it in GitHub Desktop.
Save adaedra/5854e1ec31b4794dbfd1 to your computer and use it in GitHub Desktop.
module Foo
def meth11
# This will be an instance method
11
end
define_method :meth12 do
# This will be an instance method
12
end
end
Foo.instance_exec do
def meth21
# This will be a module method
21
end
define_method :meth22 do
# This will be an instance method
22
end
end
p Foo.instance_methods.include?(:meth11) # true
p Foo.instance_methods.include?(:meth12) # true
p Foo.instance_methods.include?(:meth21) # false
p Foo.instance_methods.include?(:meth22) # true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment