Class: Elsmore::Emitter

Inherits:
Object
  • Object
show all
Defined in:
lib/elsmore/emitter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEmitter

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

#debugObject

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 message
  if debug
    puts message
  else
    print ".".colorize(:green)
  end
end

#newlineObject



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 message
  if debug
    puts message.colorize(:yellow)
  else
    print ".".colorize(:yellow)
  end
end