Sha256: 92b48c2e5eec1a54ce9d4ffb3ace1b3d05392b3327819982146ba1e049fc0cc2
Contents?: true
Size: 733 Bytes
Versions: 42
Compression:
Stored size: 733 Bytes
Contents
module CassandraObject module Identity class NaturalKeyFactory < AbstractKeyFactory class NaturalKey attr_reader :value def initialize(value) @value = value end def to_s value end def ==(other) other.to_s == to_s end end attr_reader :attributes, :separator def initialize(options) @attributes = [*options[:attributes]] @separator = options[:separator] || "-" end def next_key(object) NaturalKey.new(attributes.map { |a| object.attributes[a.to_s] }.join(separator)) end def parse(paramized_key) NaturalKey.new(paramized_key) end end end end
Version data entries
42 entries across 42 versions & 1 rubygems