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