Class: Log::Forward
- Inherits:
-
Object
- Object
- Log::Forward
- Includes:
- Converter, FakeIO
- Defined in:
- lib/log/forward.rb
Overview
Instance Method Summary collapse
-
#initialize(to, type = :info) ⇒ Forward
constructor
A new instance of Forward.
- #inspect ⇒ Object
- #process(obj) ⇒ Object
Methods included from FakeIO
#<<, #printf, #process_buffer, #puts, #write
Constructor Details
#initialize(to, type = :info) ⇒ Forward
Returns a new instance of Forward.
29 30 31 32 33 34 |
# File 'lib/log/forward.rb', line 29 def initialize(to, type=:info) raise ArgumentError, "Target must respond to 'puts'" unless to.respond_to?(:puts) @to = to @default_type = type @buffer = "" end |
Instance Method Details
#inspect ⇒ Object
40 41 42 43 44 45 46 47 |
# File 'lib/log/forward.rb', line 40 def inspect "#<%s:%08x %s %s>" % [ self.class, object_id, @default_type, @to.inspect ] end |
#process(obj) ⇒ Object
36 37 38 |
# File 'lib/log/forward.rb', line 36 def process(obj) @to.puts(obj) end |