Created
July 8, 2015 16:38
-
-
Save aycabta/69bc373946aa338da5df to your computer and use it in GitHub Desktop.
This file contains hidden or 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 GreatestModule | |
def puts arg | |
super arg + " is greatest word" | |
end | |
end | |
module Kernel | |
prepend GreatestModule | |
end | |
Kernel.puts "hi" # => hi | |
Object.__send__ :puts, "hi" # => hi | |
puts "hi" # => hi | |
p Kernel.ancestors # => [GreatestModule, Kernel] | |
p Object.ancestors # => [Object, Kernel, BasicObject] | |
include Kernel | |
Kernel.puts "hi" # => hi | |
Object.__send__ :puts, "hi" # => hi is greatest word | |
puts "hi" # => hi is greatest word | |
p Kernel.ancestors # => [GreatestModule, Kernel] | |
p Object.ancestors # => [Object, GreatestModule, Kernel, BasicObject] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment