colored-not
Toggles methods from colored gem.
Installation
gem install colored-not
Scenario
colored gem will add a bunch of coloring methods to String class.
require 'colored'
"Roses are red".red # Returns "\e[31mRoses are red\e[0m"
OK, but what if we want to dynamically turn off colored output,
without removing calls to those methods scattered all over the code?
Colored.not!
will replace the added methods with String#dup
s.
require 'colored/not'
Colored.not!
"Roses are red... not!".red # Returns "Roses are red... not!"
We can re-enable the colors.
Colored!
"Roses are red again".red # Returns "\e[31mRoses are red again\e[0m"