Module: BundleSafeUpdate::ColorOutput
- Included in:
- CLI
- Defined in:
- lib/bundle_safe_update/color_output.rb
Constant Summary collapse
- COLORS =
{ green: "\e[32m", yellow: "\e[33m", red: "\e[31m", cyan: "\e[36m", reset: "\e[0m" }.freeze
Instance Method Summary collapse
- #colorize(text, color) ⇒ Object
- #cyan(text) ⇒ Object
- #green(text) ⇒ Object
- #red(text) ⇒ Object
- #yellow(text) ⇒ Object
Instance Method Details
#colorize(text, color) ⇒ Object
13 14 15 16 17 |
# File 'lib/bundle_safe_update/color_output.rb', line 13 def colorize(text, color) return text unless tty? "#{COLORS[color]}#{text}#{COLORS[:reset]}" end |
#cyan(text) ⇒ Object
31 32 33 |
# File 'lib/bundle_safe_update/color_output.rb', line 31 def cyan(text) colorize(text, :cyan) end |
#green(text) ⇒ Object
19 20 21 |
# File 'lib/bundle_safe_update/color_output.rb', line 19 def green(text) colorize(text, :green) end |
#red(text) ⇒ Object
27 28 29 |
# File 'lib/bundle_safe_update/color_output.rb', line 27 def red(text) colorize(text, :red) end |
#yellow(text) ⇒ Object
23 24 25 |
# File 'lib/bundle_safe_update/color_output.rb', line 23 def yellow(text) colorize(text, :yellow) end |