Class: AbCrunch::LogConsoleWriter
- Inherits:
-
Object
- Object
- AbCrunch::LogConsoleWriter
- Defined in:
- lib/abcrunch/log_console_writer.rb
Constant Summary collapse
- TYPE_STYLES =
{ :info => { :color => :white, :prefix => ' ' }, :test => { :color => :light_white, :prefix => "\n\n-----" }, :strategy => { :color => :light_white, :prefix => "\n" }, :task => { :color => :white, :prefix => "\n " }, :progress => { :color => :green, :prefix => ' ' }, :result => { :color => :light_green, :prefix => ' ' }, :ab_result => { :color => :cyan, :prefix => ' ' }, :success => { :color => :light_green, :prefix => ' ' }, :failure => { :color => :light_red, :prefix => ' ' }, :summary => { :color => :light_white, :prefix => '' }, :summary_title => { :color => :light_white, :prefix => "\n==================== " }, :summary_passed => { :color => :light_green, :prefix => '' }, :summary_failed => { :color => :light_red, :prefix => '' }, }
- @@last_inline =
false
Class Method Summary collapse
- .color_for_type(type) ⇒ Object
- .log(type, message, options = {}) ⇒ Object
- .prefix_for_type(type) ⇒ Object
Class Method Details
.color_for_type(type) ⇒ Object
24 25 26 |
# File 'lib/abcrunch/log_console_writer.rb', line 24 def self.color_for_type(type) TYPE_STYLES[type] ? TYPE_STYLES[type][:color] : :white end |
.log(type, message, options = {}) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/abcrunch/log_console_writer.rb', line 32 def self.log(type, , = {}) = prefix_for_type(type) + if [:inline] print .send(color_for_type type) @@last_inline = true else = "\n#{a_message}" if @@last_inline puts .send(color_for_type type) @@last_inline = false end end |
.prefix_for_type(type) ⇒ Object
28 29 30 |
# File 'lib/abcrunch/log_console_writer.rb', line 28 def self.prefix_for_type(type) TYPE_STYLES[type] ? TYPE_STYLES[type][:prefix] : '' end |