Class: Bump::Logger
- Inherits:
-
Object
- Object
- Bump::Logger
- Defined in:
- lib/bump/logger.rb
Overview
The logging class
Instance Method Summary collapse
-
#colorize(text, color_code) ⇒ String
Colorize the text by the color code.
-
#green(text) ⇒ String
Returns a green string.
-
#initialize(no_color = nil) ⇒ Logger
constructor
A new instance of Logger.
-
#log(message = '', breakline = true) ⇒ void
Logs the message.
-
#red(text) ⇒ String
Returns a red string.
Constructor Details
#initialize(no_color = nil) ⇒ Logger
Returns a new instance of Logger.
4 5 6 |
# File 'lib/bump/logger.rb', line 4 def initialize(no_color = nil) @no_color = no_color end |
Instance Method Details
#colorize(text, color_code) ⇒ String
Colorize the text by the color code.
24 25 26 27 28 29 30 |
# File 'lib/bump/logger.rb', line 24 def colorize(text, color_code) if @no_color text else "\e[#{color_code}m#{text}\e[0m" end end |
#green(text) ⇒ String
Returns a green string.
36 37 38 |
# File 'lib/bump/logger.rb', line 36 def green(text) colorize text, 32 end |
#log(message = '', breakline = true) ⇒ void
This method returns an undefined value.
Logs the message.
13 14 15 16 17 |
# File 'lib/bump/logger.rb', line 13 def log( = '', breakline = true) print print "\n" if breakline end |
#red(text) ⇒ String
Returns a red string.
44 45 46 |
# File 'lib/bump/logger.rb', line 44 def red(text) colorize text, 31 end |