Class: Formatador
- Inherits:
-
Object
- Object
- Formatador
- Defined in:
- lib/dgit/log.rb
Class Attribute Summary collapse
-
.level ⇒ Object
Returns the value of attribute level.
Class Method Summary collapse
- .debug(str) ⇒ Object
- .error(str) ⇒ Object
- .info(str) ⇒ Object
- .ok(str) ⇒ Object
- .visible(method) ⇒ Object
- .warn(str) ⇒ Object
Class Attribute Details
.level ⇒ Object
Returns the value of attribute level.
24 25 26 |
# File 'lib/dgit/log.rb', line 24 def level @level end |
Class Method Details
.debug(str) ⇒ Object
31 32 33 |
# File 'lib/dgit/log.rb', line 31 def self.debug(str) Formatador.display_line(str) if visible(__method__) end |
.error(str) ⇒ Object
43 44 45 |
# File 'lib/dgit/log.rb', line 43 def self.error(str) Formatador.display_line("[red]#{str}[/]") if visible(__method__) end |
.info(str) ⇒ Object
27 28 29 |
# File 'lib/dgit/log.rb', line 27 def self.info(str) Formatador.display_line(str) if visible(__method__) end |
.ok(str) ⇒ Object
35 36 37 |
# File 'lib/dgit/log.rb', line 35 def self.ok(str) Formatador.display_line("[green]#{str}[/]") if visible(__method__) end |
.visible(method) ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/dgit/log.rb', line 47 def self.visible(method) target = method.to_sym if i[ok error info].include?(target) true elsif (target == :warn || target == :debug) && level == :fine true else false end end |
.warn(str) ⇒ Object
39 40 41 |
# File 'lib/dgit/log.rb', line 39 def self.warn(str) Formatador.display_line("[yellow]#{str}[/]") if visible(__method__) end |