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.
27 28 29 |
# File 'lib/dgit/log.rb', line 27 def level @level end |
Class Method Details
.debug(str) ⇒ Object
34 35 36 |
# File 'lib/dgit/log.rb', line 34 def self.debug(str) Formatador.display_line(str) if visible(__method__) end |
.error(str) ⇒ Object
46 47 48 |
# File 'lib/dgit/log.rb', line 46 def self.error(str) Formatador.display_line("[red]#{str}[/]") if visible(__method__) end |
.info(str) ⇒ Object
30 31 32 |
# File 'lib/dgit/log.rb', line 30 def self.info(str) Formatador.display_line(str) if visible(__method__) end |
.ok(str) ⇒ Object
38 39 40 |
# File 'lib/dgit/log.rb', line 38 def self.ok(str) Formatador.display_line("[green]#{str}[/]") if visible(__method__) end |
.visible(method) ⇒ Object
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/dgit/log.rb', line 50 def self.visible(method) target = method.to_sym if target == :ok || target == :error || target == :info true elsif (target == :warn || target == :debug) && level == :fine true else false end end |
.warn(str) ⇒ Object
42 43 44 |
# File 'lib/dgit/log.rb', line 42 def self.warn(str) Formatador.display_line("[yellow]#{str}[/]") if visible(__method__) end |