Class: PassStation::Output::Json

Inherits:
Object
  • Object
show all
Defined in:
lib/pass_station/output.rb

Overview

JSON formatter

Class Method Summary collapse

Class Method Details

.format(table) ⇒ Array<String>

Format the Array<CSV::Row> into JSON

Parameters:

  • table (Array<CSV::Row>)

    an Array<CSV::Row>

Returns:

  • (Array<String>)

    the formatted JSON ready to be printed (only one element on the array, keep an array for compatibility with DB#highlight_found and homogeneity with other formatters)



223
224
225
# File 'lib/pass_station/output.rb', line 223

def format(table)
  [table.map(&:to_h).to_json]
end