Class: Toy::Identity::NativeUUIDKeyFactory

Inherits:
AbstractKeyFactory show all
Defined in:
lib/toy/identity/native_uuid_key_factory.rb

Instance Method Summary collapse

Methods inherited from AbstractKeyFactory

#eql?

Instance Method Details

#key_typeObject



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

def key_type
  SimpleUUID::UUID
end

#next_key(object) ⇒ Object



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

def next_key(object)
  SimpleUUID::UUID.new
end

#to_key(object) ⇒ Object



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

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