Class: VGH::Output

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

Overview

Description:

This class sends messages to STDOUT or to a log file. It takes the following standard methods:

  • debug

  • info

  • warn

  • error

  • fatal

If stdout is called then the message is only sent to STDOUT.

If header or footer is called then it displays them.

Usage:

# Load output
message = Output.new

message.header

message.info "Starting code"
# Your code here
message.info "End code"

message.footer

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#debug(message) ⇒ Object (readonly)

Writes a debug log message and outputs to screen



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

def debug
  @debug
end

#error(message) ⇒ Object (readonly)

Writes an error log message and outputs to screen



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

def error
  @error
end

#fatal(message) ⇒ Object (readonly)

Writes a fatal log message and outputs to screen



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

def fatal
  @fatal
end

Returns the footer



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

def footer
  @footer
end

#headerObject (readonly)

Returns the header



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

def header
  @header
end

#info(message) ⇒ Object (readonly)

Writes an info log message and outputs to screen



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

def info
  @info
end

#warn(message) ⇒ Object (readonly)

Writes an warn log message and outputs to screen



42
43
44
# File 'lib/vgh/output.rb', line 42

def warn
  @warn
end

Instance Method Details

#stdout(message) ⇒ Object

Outputs a message to screen



83
84
85
# File 'lib/vgh/output.rb', line 83

def stdout(message)
  puts message if verbose?
end