Class: CassandraObject::Identity::CustomKeyFactory

Inherits:
AbstractKeyFactory show all
Defined in:
lib/cassandra_object/identity/custom_key_factory.rb

Defined Under Namespace

Classes: CustomKey

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ CustomKeyFactory

Returns a new instance of CustomKeyFactory.



32
33
34
# File 'lib/cassandra_object/identity/custom_key_factory.rb', line 32

def initialize(options)
  @method = options[:method]
end

Instance Attribute Details

#methodObject (readonly)

Returns the value of attribute method.



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

def method
  @method
end

Instance Method Details

#create(paramized_key) ⇒ Object



44
45
46
# File 'lib/cassandra_object/identity/custom_key_factory.rb', line 44

def create(paramized_key)
  CustomKey.new(paramized_key)
end

#next_key(object) ⇒ Object



36
37
38
# File 'lib/cassandra_object/identity/custom_key_factory.rb', line 36

def next_key(object)
  CustomKey.new(object.send(@method))
end

#parse(paramized_key) ⇒ Object



40
41
42
# File 'lib/cassandra_object/identity/custom_key_factory.rb', line 40

def parse(paramized_key)
  CustomKey.new(paramized_key)
end