On Aug 22, 10:57 am, aidy [email protected] wrote:
Is it possible to temporarily redefine the ‘puts’ command?
I have a gem that unnecessarily writes to the console, which effects
the Rspec Story Runner logging,
I do not want to manual comment out the puts as I use this gem on
Here’s some code, which should work for you. Of course you’ll have to
answer the questions as where to put the methods puts_on and puts_off
(or whatever you decide to name them).
replaces Kernel#puts w/ do-nothing method
restores Kernel#puts to its original definition
puts “You can see me.”
puts “But I’m hidden.”
puts “But I’m viewable once again.”
Interested in hands-on, on-site Ruby or Ruby on Rails
training? See http://LearnRuby.com for information about a