Sha256: 841dfe68342996ca7d21bccd734c4a8c101587b1c7e20bdef56957a490b41d54

Contents?: true

Size: 763 Bytes

Versions: 5

Compression:

Stored size: 763 Bytes

Contents

#!/usr/bin/env ruby
# vim: set nosta noet ts=4 sw=4:
# encoding: utf-8

require 'loggability/logger' unless defined?( Loggability::Logger )

# A log device that appends to the object it's constructed with instead of writing
# to a file descriptor or a file.
class Loggability::LogDevice::Appending < Loggability::LogDevice

	### Create a new +Appending+ log device that will append content to +array+.
	def initialize( target )
		@target = target || []
	end


	######
	public
	######

	# The target of the log device
	attr_reader :target


	### Append the specified +message+ to the target.
	def write( message )
		@target << message
	end


	### No-op -- this is here just so Logger doesn't complain
	def close; end

end # class Loggability::LogDevice::Appending

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
loggability-0.18.2 lib/loggability/log_device/appending.rb
loggability-0.18.1 lib/loggability/log_device/appending.rb
loggability-0.18.0 lib/loggability/log_device/appending.rb
loggability-0.17.0 lib/loggability/log_device/appending.rb
loggability-0.16.0 lib/loggability/log_device/appending.rb