Sha256: f50b0399bf4d9a72433a5fac08644f9441e2cfe73a01327760a875983da6ac21

Contents?: true

Size: 366 Bytes

Versions: 1

Compression:

Stored size: 366 Bytes

Contents

require 'json'
require 'citrus/event_bus/event'

module Citrus
  module EventBus
    class Serializer

      def load(event_data)
        event_hash = JSON.load(event_data)
        event_hash.each_with_object(Event.new) { |(key, value), event| event.send("#{key}=", value) }
      end

      def dump(event)
        JSON.dump(event.to_h)
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
citrus-event-bus-0.0.1 lib/citrus/event_bus/serializer.rb