Module: Guard::CoffeeScript::Formatter
- Defined in:
- lib/guard/coffeescript/formatter.rb
Overview
The Guard::CoffeeScript formatter collects console and system notification methods and enhances them with some color information.
Class Method Summary (collapse)
-
+ (Object) color(text, color_code)
private
Print a info message to the console.
-
+ (Object) debug(message, options = { })
Print a debug message to the console.
-
+ (Object) error(message, options = { })
Print a red error message to the console.
-
+ (Object) info(message, options = { })
Print an info message to the console.
-
+ (Object) notify(message, options = { })
Outputs a system notification.
-
+ (Object) success(message, options = { })
Print a green success message to the console.
Class Method Details
+ (Object) color(text, color_code) (private)
Print a info message to the console.
70 71 72 |
# File 'lib/guard/coffeescript/formatter.rb', line 70 def color(text, color_code) ::Guard::UI.send(:color_enabled?) ? "\e[0#{ color_code }m#{ text }\e[0m" : text end |
+ (Object) debug(message, options = { })
Print a debug message to the console.
27 28 29 |
# File 'lib/guard/coffeescript/formatter.rb', line 27 def debug(, = { }) ::Guard::UI.debug(, ) end |
+ (Object) error(message, options = { })
Print a red error message to the console.
37 38 39 |
# File 'lib/guard/coffeescript/formatter.rb', line 37 def error(, = { }) ::Guard::UI.error(color(, ';31'), ) end |
+ (Object) info(message, options = { })
Print an info message to the console.
17 18 19 |
# File 'lib/guard/coffeescript/formatter.rb', line 17 def info(, = { }) ::Guard::UI.info(, ) end |
+ (Object) notify(message, options = { })
Outputs a system notification.
59 60 61 |
# File 'lib/guard/coffeescript/formatter.rb', line 59 def notify(, = { }) ::Guard::Notifier.notify(, ) end |
+ (Object) success(message, options = { })
Print a green success message to the console.
47 48 49 50 |
# File 'lib/guard/coffeescript/formatter.rb', line 47 def success(, = { }) = "#{Time.now.strftime('%r')} #{}" ::Guard::UI.info(color(, ';32'), ) end |