Skip to content

Instantly share code, notes, and snippets.

@valachi
Created February 7, 2013 13:16
Show Gist options
  • Save valachi/4730835 to your computer and use it in GitHub Desktop.
Save valachi/4730835 to your computer and use it in GitHub Desktop.
class Man
def self.setup
puts caller.inspect
puts 'im a man'
end
end
class Woman
def self.setup_man
Man.setup
end
end
class << Man
instance_methods.each do |method_name|
original_method = instance_method(method_name)
define_method(original_method) { puts caller.inspect }
undef_method(method_name)
end
def method_missing(method, *args)
send method, *args
end
end
Woman.setup_man
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment