Class: Elsmore::Emitter
- Inherits:
-
Object
- Object
- Elsmore::Emitter
- Defined in:
- lib/elsmore/emitter.rb
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
Instance Method Summary collapse
- #debug! ⇒ Object
-
#initialize ⇒ Emitter
constructor
A new instance of Emitter.
- #log(message) ⇒ Object
- #newline ⇒ Object
- #pretty(value) ⇒ Object
- #warning(message) ⇒ Object
Constructor Details
#initialize ⇒ Emitter
Returns a new instance of Emitter.
8 9 10 |
# File 'lib/elsmore/emitter.rb', line 8 def initialize self.debug = false end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
6 7 8 |
# File 'lib/elsmore/emitter.rb', line 6 def debug @debug end |
Instance Method Details
#debug! ⇒ Object
12 13 14 |
# File 'lib/elsmore/emitter.rb', line 12 def debug! self.debug = true end |
#log(message) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/elsmore/emitter.rb', line 24 def log if debug puts else print ".".colorize(:green) end end |
#newline ⇒ Object
16 17 18 |
# File 'lib/elsmore/emitter.rb', line 16 def newline puts "\n" end |
#pretty(value) ⇒ Object
20 21 22 |
# File 'lib/elsmore/emitter.rb', line 20 def pretty value ap value end |
#warning(message) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/elsmore/emitter.rb', line 32 def warning if debug puts .colorize(:yellow) else print ".".colorize(:yellow) end end |