Sha256: f59536c808921da8294b8985135f23cab1ed321f2b7f8fd765a997f5f77ad406

Contents?: true

Size: 1.19 KB

Versions: 144

Compression:

Stored size: 1.19 KB

Contents

module CassandraObject
  module Identity
    # Key factories need to support 3 operations
    class AbstractKeyFactory
      # 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
      #
      # @param  [CassandraObject::Base] the object that needs a new key
      # @return [CassandraObject::Identity::Key] the key
      #
      def next_key(object)
        raise NotImplementedError, "#{self.class.name}#next_key isn't implemented."
      end

      # Parse should create a new key object from the 'to_param' format
      #
      # @param  [String] the result of calling key.to_param
      # @return [CassandraObject::Identity::Key] the parsed key
      #
      def parse(string)
        raise NotImplementedError, "#{self.class.name}#parse isn't implemented."
      end


      # create should create a new key object from the cassandra format.
      #
      # @param  [String] the result of calling key.to_s
      # @return [CassandraObject::Identity::Key] the key
      #
      def create(string)
        raise NotImplementedError, "#{self.class.name}#create isn't implemented."
      end
    end
  end
end

Version data entries

144 entries across 144 versions & 3 rubygems

Version Path
sessionm-cassandra_object-2.2.44 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.2.43 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.2.42 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.2.41 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.2.40 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.2.39 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.2.38 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.2.37 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.2.36 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.2.35 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.2.34 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.2.33 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.2.32 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.2.31 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.2.30 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.2.29 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.2.28 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.2.27 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.2.26 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.2.24 lib/cassandra_object/identity/abstract_key_factory.rb