Last active
April 10, 2019 04:09
-
-
Save XrXr/dc78220bdb01057ea194c4a97069648f to your computer and use it in GitHub Desktop.
A way to catch calls to Kernel#puts
This file contains 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 Kernel | |
original_puts = instance_method(:puts) | |
define_method(:puts) do |*args| | |
$stdout.puts("how are you doing") | |
# binding.pry | |
original_puts.bind(self).call(*args) | |
end | |
end | |
puts "I'm doing fine thanks" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment