Skip to content

Instantly share code, notes, and snippets.

@irridescentrambler
Last active August 27, 2019 17:06
Show Gist options
  • Save irridescentrambler/44eea9faa794f8379aac5eeab826896f to your computer and use it in GitHub Desktop.
Save irridescentrambler/44eea9faa794f8379aac5eeab826896f to your computer and use it in GitHub Desktop.
module SuperPowers
def powers
puts "I can run at 80 mph and lift 200 lbs weight"
end
end
class Human
def introduce
puts "Hi i am a #{self.class.name}"
end
end
class SuperHuman < Human
include SuperPowers
end
# ["simple_method_lookup_demo.rb", 2]
puts SuperHuman.new.method(:introduce).source_location.inspect
# ["simple_method_lookup_demo", 8]
puts SuperHuman.new.method(:powers).source_location.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment