Sha256: e23f650acd50d5052a22933484c97996daa560cc94c4b2cb73a911668468150a

Contents?: true

Size: 510 Bytes

Versions: 3

Compression:

Stored size: 510 Bytes

Contents

module Toy
  module Identity
    class AbstractKeyFactory
      def key_type
        raise NotImplementedError, "#{self.class.name}.store_type isn't implemented."
      end

      def next_key(object)
        raise NotImplementedError, "#{self.class.name}#next_key isn't implemented."
      end

      def to_key(object)
        [object.id] if object.persisted?
      end

      def eql?(other)
        self.class == other.class && key_type == other.key_type
      end
      alias :== :eql?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
toystore-0.13.2 lib/toy/identity/abstract_key_factory.rb
toystore-0.13.1 lib/toy/identity/abstract_key_factory.rb
toystore-0.13.0 lib/toy/identity/abstract_key_factory.rb