class RubyEventStore::Mappers::Pipeline
Attributes
Public Class Methods
Source
# File lib/ruby_event_store/mappers/pipeline.rb, line 6 def initialize(*transformations, to_domain_event: Transformation::DomainEvent.new) @transformations = [to_domain_event, transformations].flatten.freeze end
Public Instance Methods
Source
# File lib/ruby_event_store/mappers/pipeline.rb, line 10 def dump(event) transformations.reduce(event) { |item, transform| transform.dump(item) } end
Source
# File lib/ruby_event_store/mappers/pipeline.rb, line 14 def load(record) transformations.reverse.reduce(record) { |item, transform| transform.load(item) } end