Class: Sprinkle::Utility::LogRecorder
- Defined in:
- lib/sprinkle/utility/log_recorder.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#command ⇒ Object
Returns the value of attribute command.
-
#err ⇒ Object
Returns the value of attribute err.
-
#out ⇒ Object
Returns the value of attribute out.
Instance Method Summary collapse
-
#hash ⇒ Object
hash suitable to pass into a pretty failure details hash.
-
#initialize(cmd = nil) ⇒ LogRecorder
constructor
A new instance of LogRecorder.
- #log(stream, data) ⇒ Object
- #reset(cmd = nil) ⇒ Object
Constructor Details
#initialize(cmd = nil) ⇒ LogRecorder
Returns a new instance of LogRecorder.
7 8 9 |
# File 'lib/sprinkle/utility/log_recorder.rb', line 7 def initialize(cmd=nil) reset(cmd) end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
5 6 7 |
# File 'lib/sprinkle/utility/log_recorder.rb', line 5 def code @code end |
#command ⇒ Object
Returns the value of attribute command.
5 6 7 |
# File 'lib/sprinkle/utility/log_recorder.rb', line 5 def command @command end |
#err ⇒ Object
Returns the value of attribute err.
5 6 7 |
# File 'lib/sprinkle/utility/log_recorder.rb', line 5 def err @err end |
#out ⇒ Object
Returns the value of attribute out.
5 6 7 |
# File 'lib/sprinkle/utility/log_recorder.rb', line 5 def out @out end |
Instance Method Details
#hash ⇒ Object
hash suitable to pass into a pretty failure details hash
19 20 21 |
# File 'lib/sprinkle/utility/log_recorder.rb', line 19 def hash {:error => err, :stdout => out, :command => command, :code => code} end |
#log(stream, data) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/sprinkle/utility/log_recorder.rb', line 11 def log(stream, data) case stream when :err then @err << data when :out then @out << data end end |
#reset(cmd = nil) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/sprinkle/utility/log_recorder.rb', line 23 def reset(cmd=nil) @command=cmd @code=nil @err="" @out="" end |