Class: Loggability::LogDevice::Appending
- Inherits:
-
Loggability::LogDevice
- Object
- Loggability::LogDevice
- Loggability::LogDevice::Appending
- Defined in:
- lib/loggability/log_device/appending.rb
Overview
A log device that appends to the object it’s constructed with instead of writing to a file descriptor or a file.
Constant Summary
Constants inherited from Loggability::LogDevice
Instance Attribute Summary collapse
-
#target ⇒ Object
readonly
The target of the log device.
Instance Method Summary collapse
-
#close ⇒ Object
No-op – this is here just so Logger doesn’t complain.
-
#initialize(target) ⇒ Appending
constructor
Create a new
Appending
log device that will append content toarray
. -
#write(message) ⇒ Object
Append the specified
message
to the target.
Methods inherited from Loggability::LogDevice
create, load_device_type, parse_device_spec
Constructor Details
#initialize(target) ⇒ Appending
Create a new Appending
log device that will append content to array
.
12 13 14 |
# File 'lib/loggability/log_device/appending.rb', line 12 def initialize( target ) @target = target || [] end |
Instance Attribute Details
#target ⇒ Object (readonly)
The target of the log device
22 23 24 |
# File 'lib/loggability/log_device/appending.rb', line 22 def target @target end |
Instance Method Details
#close ⇒ Object
No-op – this is here just so Logger doesn’t complain
32 |
# File 'lib/loggability/log_device/appending.rb', line 32 def close; end |
#write(message) ⇒ Object
Append the specified message
to the target.
26 27 28 |
# File 'lib/loggability/log_device/appending.rb', line 26 def write( ) @target << end |