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-4.0.32 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-4.0.31 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-4.0.30 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-4.0.29 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-4.0.28 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-4.0.27 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-4.0.26 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-4.0.25 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-4.0.24 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-4.0.23 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-4.0.22 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-4.0.21 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-4.0.20 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.7.5 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-2.7.4 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-4.0.18 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-4.0.17 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-4.0.16 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-4.0.15 lib/cassandra_object/identity/abstract_key_factory.rb
sessionm-cassandra_object-4.0.14 lib/cassandra_object/identity/abstract_key_factory.rb