Class: Output

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

Defined Under Namespace

Classes: DummyOutput

Constant Summary collapse

STATUS_WIDTH =
"50"
OKAY =
"OK"
SKIPPED =
"SKIPPED"
FAILED =
"FAILED"

Class Method Summary collapse

Class Method Details

.dummy_outputObject



61
62
63
# File 'lib/output.rb', line 61

def dummy_output
	@dummy_output ||= DummyOutput.new
end

.error(msg) ⇒ Object



45
46
47
# File 'lib/output.rb', line 45

def error(msg)
	@err.puts(msg.red)
end

.failedObject



35
36
37
# File 'lib/output.rb', line 35

def failed
	@out.puts(FAILED.red)
end

.okayObject



27
28
29
# File 'lib/output.rb', line 27

def okay
	@out.puts(OKAY.green)
end

.out(msg) ⇒ Object



49
50
51
# File 'lib/output.rb', line 49

def out(msg)
	@out.puts(msg)
end


53
54
55
# File 'lib/output.rb', line 53

def print(msg)
	@out.print(msg)
end

.silenceObject



57
58
59
# File 'lib/output.rb', line 57

def silence
	@out = @err = dummy_output
end

.skippedObject



31
32
33
# File 'lib/output.rb', line 31

def skipped
	@out.puts(SKIPPED.yellow)
end

.status(name) ⇒ Object



23
24
25
# File 'lib/output.rb', line 23

def status(name)
	@out.print(format("%-#{STATUS_WIDTH}<name>s ", name: name))
end

.warn(msg) ⇒ Object Also known as: notice



39
40
41
# File 'lib/output.rb', line 39

def warn(msg)
	@err.puts(msg.yellow)
end