Class: Toy::Identity::AbstractKeyFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/toy/identity/abstract_key_factory.rb

Direct Known Subclasses

NativeUUIDKeyFactory, UUIDKeyFactory

Instance Method Summary collapse

Instance Method Details

#eql?(other) ⇒ Boolean Also known as: ==

Returns:



16
17
18
# File 'lib/toy/identity/abstract_key_factory.rb', line 16

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

#key_typeObject

Raises:

  • (NotImplementedError)


4
5
6
# File 'lib/toy/identity/abstract_key_factory.rb', line 4

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

#next_key(object) ⇒ Object

Raises:

  • (NotImplementedError)


8
9
10
# File 'lib/toy/identity/abstract_key_factory.rb', line 8

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

#to_key(object) ⇒ Object



12
13
14
# File 'lib/toy/identity/abstract_key_factory.rb', line 12

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