Sha256: 15d8f7d80f446a9edc2d624f5d6312bf45b95e4eea5d29107f5c5e6d2f2ae912
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
require 'forwardable' module SandthornDriverSequel2 module FileOutputWrapper class Events extend Forwardable def initialize event_file, sequence_number, delimiter: ',' @event_file = event_file @sequence_number = sequence_number @delimiter = delimiter end def events sequel @sequel = sequel self end def insert *args args.each do |event| @sequence_number += 1 event_data = String.new("#{event[:event_data]}") event_data = " #{event_data}" if event_data =~ /^[\n\r]/ @event_file.puts "#{@sequence_number}#{@delimiter}#{event[:aggregate_id]}#{@delimiter}#{event[:aggregate_version]}#{@delimiter}#{event[:aggregate_type]}#{@delimiter}#{event[:event_name]}#{@delimiter}#{event_data}#{@delimiter}#{event[:timestamp]}" end end def_delegators :@sequel, :first, :where, :join, :select, :all def save *args @event_file.write args end def flush @event_file.flush end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sandthorn_driver_sequel_2-0.0.2 | lib/sandthorn_driver_sequel_2/file_output_wrappers/events.rb |