Class: Rialto::Etl::Writers::JsonldWriter
- Inherits:
-
Object
- Object
- Rialto::Etl::Writers::JsonldWriter
- Defined in:
- lib/rialto/etl/writers/jsonld_writer.rb
Overview
Write JSON-LD records. This writer conforms to Traject’s writer class interface, supporting #initialize, #put, and #close
Instance Method Summary collapse
-
#close ⇒ Object
Print a JSON representation of the records with the JSON-LD context object attached.
-
#initialize(_) ⇒ JsonldWriter
constructor
Constructor.
-
#put(context) ⇒ Array
Append the hash representing a single mapped record to the list of records held in memory.
Constructor Details
#initialize(_) ⇒ JsonldWriter
Constructor
14 |
# File 'lib/rialto/etl/writers/jsonld_writer.rb', line 14 def initialize(_); end |
Instance Method Details
#close ⇒ Object
Print a JSON representation of the records with the JSON-LD context object attached
28 29 30 |
# File 'lib/rialto/etl/writers/jsonld_writer.rb', line 28 def close $stdout.puts records.to_json end |
#put(context) ⇒ Array
Append the hash representing a single mapped record to the list of records held in memory
22 23 24 |
# File 'lib/rialto/etl/writers/jsonld_writer.rb', line 22 def put(context) records << context.output_hash end |