Class: Pcrd::Reporter::Console

Inherits:
Object
  • Object
show all
Defined in:
lib/pcrd/reporter/console.rb

Instance Method Summary collapse

Constructor Details

#initialize(out: $stdout) ⇒ Console

Returns a new instance of Console.



19
20
21
22
# File 'lib/pcrd/reporter/console.rb', line 19

def initialize(out: $stdout)
  @out    = out
  @pastel = Pastel.new
end

Instance Method Details

#green(str) ⇒ Object



41
42
43
# File 'lib/pcrd/reporter/console.rb', line 41

def green(str)
  @pastel.green(str)
end

#info(msg = "") ⇒ Object



24
25
26
# File 'lib/pcrd/reporter/console.rb', line 24

def info(msg = "")
  @out.puts(msg)
end

#status(msg) ⇒ Object



36
37
38
39
# File 'lib/pcrd/reporter/console.rb', line 36

def status(msg)
  @out.print("\r#{msg}")
  @out.flush
end

#success(msg) ⇒ Object



28
29
30
# File 'lib/pcrd/reporter/console.rb', line 28

def success(msg)
  @out.puts(@pastel.green(msg))
end

#warn(msg) ⇒ Object



32
33
34
# File 'lib/pcrd/reporter/console.rb', line 32

def warn(msg)
  @out.puts(@pastel.yellow(msg))
end