Class: Loggability::LogDevice::Appending

Inherits:
Loggability::LogDevice show all
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

DEVICE_TARGET_REGEX

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#targetObject (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

#closeObject

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( message )
	@target << message
end