Skip to content

Instantly share code, notes, and snippets.

@aycabta
Created July 8, 2015 16:38
Show Gist options
  • Save aycabta/69bc373946aa338da5df to your computer and use it in GitHub Desktop.
Save aycabta/69bc373946aa338da5df to your computer and use it in GitHub Desktop.
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