Class: Traject::DebugWriter
- Inherits:
-
LineWriter
- Object
- LineWriter
- Traject::DebugWriter
- Defined in:
- lib/traject/debug_writer.rb
Constant Summary collapse
- DEFAULT_FORMAT =
'%-12s %-25s %s'
- DEFAULT_IDFIELD =
'id'
Instance Attribute Summary
Attributes inherited from LineWriter
Instance Method Summary collapse
Methods inherited from LineWriter
#close, #initialize, #output_file, #put
Constructor Details
This class inherits a constructor from Traject::LineWriter
Instance Method Details
#serialize(context) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/traject/debug_writer.rb', line 19 def serialize(context) idfield = settings["debug_writer.idfield"] || DEFAULT_IDFIELD format = settings['debug_writer.format'] || DEFAULT_FORMAT h = context.output_hash lines = h.keys.sort.map {|k| format % [h[idfield].first, k, h[k].join(' | ')] } lines.push "\n" lines.join("\n") end |