Sha256: ff8c9436a57b4233ee90d8c59f916176f1adba63d8bf7ad572a4e3593d335143

Contents?: true

Size: 849 Bytes

Versions: 126

Compression:

Stored size: 849 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

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

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

Version data entries

126 entries across 126 versions & 2 rubygems

Version Path
sessionm-cassandra_object-2.2.23 lib/cassandra_object/identity/custom_key_factory.rb
sessionm-cassandra_object-2.2.22 lib/cassandra_object/identity/custom_key_factory.rb
sessionm-cassandra_object-2.2.20 lib/cassandra_object/identity/custom_key_factory.rb
sessionm-cassandra_object-2.2.18 lib/cassandra_object/identity/custom_key_factory.rb
sessionm-cassandra_object-2.2.16 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.3.4 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.3.3 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.3.2 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.3.1 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.3.0 lib/cassandra_object/identity/custom_key_factory.rb
sessionm-cassandra_object-2.2.14 lib/cassandra_object/identity/custom_key_factory.rb
sessionm-cassandra_object-2.2.12 lib/cassandra_object/identity/custom_key_factory.rb
sessionm-cassandra_object-2.2.10 lib/cassandra_object/identity/custom_key_factory.rb
sessionm-cassandra_object-2.2.8 lib/cassandra_object/identity/custom_key_factory.rb
sessionm-cassandra_object-2.2.6 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.2.4 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.2.3 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.2.2 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.2.1 lib/cassandra_object/identity/custom_key_factory.rb
gotime-cassandra_object-2.2.0 lib/cassandra_object/identity/custom_key_factory.rb