Class: Lumberjack::Formatter::StructuredFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/lumberjack/formatter/structured_formatter.rb

Overview

Dereference arrays and hashes and recursively call formatters on each element.

Defined Under Namespace

Classes: RecusiveReferenceError

Instance Method Summary collapse

Constructor Details

#initialize(formatter = nil) ⇒ StructuredFormatter

Returns a new instance of StructuredFormatter.

Parameters:

  • formatter (Formatter) (defaults to: nil)

    The formatter to call on each element in the structure.



14
15
16
# File 'lib/lumberjack/formatter/structured_formatter.rb', line 14

def initialize(formatter = nil)
  @formatter = formatter
end

Instance Method Details

#call(obj) ⇒ Object



18
19
20
# File 'lib/lumberjack/formatter/structured_formatter.rb', line 18

def call(obj)
  call_with_references(obj, Set.new)
end