Class: CoopAl::Trace
Overview
Trace
Instance Attribute Summary collapse
-
#stream ⇒ Object
writeonly
Sets the attribute stream.
-
#tracing ⇒ Object
writeonly
Sets the attribute tracing.
Instance Method Summary collapse
- #error(s) ⇒ Object
- #info(s) ⇒ Object
-
#initialize ⇒ Trace
constructor
A new instance of Trace.
- #warn(s) ⇒ Object
Constructor Details
#initialize ⇒ Trace
Returns a new instance of Trace.
12 13 14 15 |
# File 'lib/coop_al/trace.rb', line 12 def initialize @tracing = false @stream = STDOUT end |
Instance Attribute Details
#stream=(value) ⇒ Object (writeonly)
Sets the attribute stream
10 11 12 |
# File 'lib/coop_al/trace.rb', line 10 def stream=(value) @stream = value end |
#tracing=(value) ⇒ Object (writeonly)
Sets the attribute tracing
10 11 12 |
# File 'lib/coop_al/trace.rb', line 10 def tracing=(value) @tracing = value end |
Instance Method Details
#error(s) ⇒ Object
25 26 27 |
# File 'lib/coop_al/trace.rb', line 25 def error(s) @stream.puts("[ERROR] #{s}") if @tracing end |
#info(s) ⇒ Object
17 18 19 |
# File 'lib/coop_al/trace.rb', line 17 def info(s) @stream.puts(s) if @tracing end |
#warn(s) ⇒ Object
21 22 23 |
# File 'lib/coop_al/trace.rb', line 21 def warn(s) @stream.puts("[WARNING] #{s}") if @tracing end |