Sha256: b4966b78b7011283aea4bde2983beecaeeae798bf60a2261f6bb8c67a67d604a

Contents?: true

Size: 452 Bytes

Versions: 14

Compression:

Stored size: 452 Bytes

Contents

module EventSourcery
  module EventStore
    module EventTypeSerializers
      # Stores event types by their class name and falls back to the generic
      # Event class if the constant is not found
      class ClassName
        def serialize(event_class)
          event_class.name
        end

        def deserialize(event_type)
          Object.const_get(event_type)
        rescue NameError
          Event
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
event_sourcery-1.0.0 lib/event_sourcery/event_store/event_type_serializers/class_name.rb
event_sourcery-0.24.0 lib/event_sourcery/event_store/event_type_serializers/class_name.rb
event_sourcery-0.23.1 lib/event_sourcery/event_store/event_type_serializers/class_name.rb
event_sourcery-0.23.0 lib/event_sourcery/event_store/event_type_serializers/class_name.rb
event_sourcery-0.22.0 lib/event_sourcery/event_store/event_type_serializers/class_name.rb
event_sourcery-0.21.0 lib/event_sourcery/event_store/event_type_serializers/class_name.rb
event_sourcery-0.20.0 lib/event_sourcery/event_store/event_type_serializers/class_name.rb
event_sourcery-0.19.0 lib/event_sourcery/event_store/event_type_serializers/class_name.rb
event_sourcery-0.18.0 lib/event_sourcery/event_store/event_type_serializers/class_name.rb
event_sourcery-0.17.0 lib/event_sourcery/event_store/event_type_serializers/class_name.rb
event_sourcery-0.16.1 lib/event_sourcery/event_store/event_type_serializers/class_name.rb
event_sourcery-0.15.0 lib/event_sourcery/event_store/event_type_serializers/class_name.rb
event_sourcery-0.14.0 lib/event_sourcery/event_store/event_type_serializers/class_name.rb
event_sourcery-0.13.0 lib/event_sourcery/event_store/event_type_serializers/class_name.rb