Class: Synthra::Output::JsonFormatter
- Inherits:
-
Object
- Object
- Synthra::Output::JsonFormatter
- Defined in:
- lib/synthra/output/json_formatter.rb
Overview
JSON formatter for generated data
Instance Method Summary collapse
-
#format(record, pretty: false) ⇒ String
Format a single record.
-
#format_many(records, pretty: false) ⇒ String
Format multiple records.
Instance Method Details
#format(record, pretty: false) ⇒ String
Format a single record
15 16 17 18 19 20 21 |
# File 'lib/synthra/output/json_formatter.rb', line 15 def format(record, pretty: false) if pretty JSON.pretty_generate(record) else JSON.generate(record) end end |
#format_many(records, pretty: false) ⇒ String
Format multiple records
30 31 32 33 34 35 36 |
# File 'lib/synthra/output/json_formatter.rb', line 30 def format_many(records, pretty: false) if pretty JSON.pretty_generate(records) else JSON.generate(records) end end |