Sha256: 9cab0bf3bd13f6113062a37d0f87fc083dda32c101b026a9e052c9158f9178f3

Contents?: true

Size: 690 Bytes

Versions: 14

Compression:

Stored size: 690 Bytes

Contents

module CassandraObject
  module Identity
    class CustomKeyFactory < AbstractKeyFactory
      class CustomKey
        include Key

        attr_reader :value

        def initialize(value)
          @value = value
        end

        def to_s
          value
        end

        def to_param
          value
        end

        def ==(other)
          other.is_a?(CustomKey) && other.value == value
        end

        def eql?(other)
          other == self
        end
      end

      attr_reader :method

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

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
gotime-cassandra_object-2.7.2 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.7.1 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.7.0 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.6.4 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.6.3 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.6.2 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.6.1 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.6.0 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.5.0 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.4.2 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.4.1 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.4.0 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.3.6 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.3.5 lib/cassandra_object/identity/custom_key_factory.rb