Class: CassandraObject::Identity::AbstractKeyFactory

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

Overview

Key factories need to support 3 operations

Instance Method Summary collapse

Instance Method Details

#create(string) ⇒ CassandraObject::Identity::Key

create should create a new key object from the cassandra format.

Parameters:

  • the (String)

    result of calling key.to_s

Returns:

Raises:

  • (NotImplementedError)


30
31
32
# File 'lib/cassandra_object/identity/abstract_key_factory.rb', line 30

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

#next_key(object) ⇒ CassandraObject::Identity::Key

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

Parameters:

Returns:

Raises:

  • (NotImplementedError)


11
12
13
# File 'lib/cassandra_object/identity/abstract_key_factory.rb', line 11

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

#parse(string) ⇒ CassandraObject::Identity::Key

Parse should create a new key object from the ‘to_param’ format

Parameters:

  • the (String)

    result of calling key.to_param

Returns:

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/cassandra_object/identity/abstract_key_factory.rb', line 20

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