Sha256: 5a10cfafa779d63ed8661500179d4a2275c11b4a03127b3be95934d70376fc29

Contents?: true

Size: 954 Bytes

Versions: 24

Compression:

Stored size: 954 Bytes

Contents

module CassandraObject
  module Identity
    # Key factories need to support 3 operations
    class UUIDKeyFactory < AbstractKeyFactory
      class UUID < SimpleUUID::UUID
        include Key

        def to_param
          to_guid
        end
        
        def to_s
          # FIXME - this should probably write the raw bytes 
          # but it's very hard to debug without this for now.
          to_guid
        end
      end
    
      # Next key takes an object and returns the key object it should use.
      # object will be ignored with synthetic keys but could be useful with natural ones
      def next_key(object)
        UUID.new
      end
      
      # Parse should create a new key object from the 'to_param' format
      def parse(string)
        UUID.new(string)
      end
      
      # create should create a new key object from the cassandra format.
      def create(string)
        UUID.new(string)
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 2 rubygems

Version Path
gotime-cassandra_object-2.1.2 lib/cassandra_object/identity/uuid_key_factory.rb
gotime-cassandra_object-2.1.1 lib/cassandra_object/identity/uuid_key_factory.rb
gotime-cassandra_object-2.1.0 lib/cassandra_object/identity/uuid_key_factory.rb
gotime-cassandra_object-2.0.0 lib/cassandra_object/identity/uuid_key_factory.rb
gotime-cassandra_object-0.9.1 lib/cassandra_object/identity/uuid_key_factory.rb
gotime-cassandra_object-0.9.0 lib/cassandra_object/identity/uuid_key_factory.rb
gotime-cassandra_object-0.8.7 lib/cassandra_object/identity/uuid_key_factory.rb
gotime-cassandra_object-0.8.6 lib/cassandra_object/identity/uuid_key_factory.rb
gotime-cassandra_object-0.8.5 lib/cassandra_object/identity/uuid_key_factory.rb
gotime-cassandra_object-0.8.4 lib/cassandra_object/identity/uuid_key_factory.rb
gotime-cassandra_object-0.8.3 lib/cassandra_object/identity/uuid_key_factory.rb
gotime-cassandra_object-0.8.2 lib/cassandra_object/identity/uuid_key_factory.rb
gotime-cassandra_object-0.8.1 lib/cassandra_object/identity/uuid_key_factory.rb
gotime-cassandra_object-0.8.0 lib/cassandra_object/identity/uuid_key_factory.rb
gotime-cassandra_object-0.7.8 lib/cassandra_object/identity/uuid_key_factory.rb
gotime-cassandra_object-0.7.7 lib/cassandra_object/identity/uuid_key_factory.rb
gotime-cassandra_object-0.7.6 lib/cassandra_object/identity/uuid_key_factory.rb
gotime-cassandra_object-0.7.5 lib/cassandra_object/identity/uuid_key_factory.rb
gotime-cassandra_object-0.7.4 lib/cassandra_object/identity/uuid_key_factory.rb
gotime-cassandra_object-0.7.3 lib/cassandra_object/identity/uuid_key_factory.rb