Sha256: 96362fc4b5e2bb0404b41ffffa3c8bc82d81916b153940426a442df6d3872cf0

Contents?: true

Size: 445 Bytes

Versions: 28

Compression:

Stored size: 445 Bytes

Contents

module CassandraObject
  module Identity
    extend ActiveSupport::Concern

    included do
      class_attribute :key_generator

      key do
        SimpleUUID::UUID.new.to_guid
      end
    end

    module ClassMethods
      # Define a key generator. Default is UUID.
      def key(&block)
        self.key_generator = block
      end

      def _generate_key(object)
        object.instance_eval(&key_generator)
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
gotime-cassandra_object-4.5.1 lib/cassandra_object/identity.rb
gotime-cassandra_object-4.5.0 lib/cassandra_object/identity.rb
gotime-cassandra_object-4.4.5 lib/cassandra_object/identity.rb
gotime-cassandra_object-4.4.4 lib/cassandra_object/identity.rb
gotime-cassandra_object-4.4.3 lib/cassandra_object/identity.rb
gotime-cassandra_object-4.4.0 lib/cassandra_object/identity.rb
gotime-cassandra_object-4.3.2 lib/cassandra_object/identity.rb
gotime-cassandra_object-4.3.1 lib/cassandra_object/identity.rb
gotime-cassandra_object-4.3.0 lib/cassandra_object/identity.rb
gotime-cassandra_object-4.2.2 lib/cassandra_object/identity.rb
gotime-cassandra_object-4.2.0 lib/cassandra_object/identity.rb
gotime-cassandra_object-4.1.0 lib/cassandra_object/identity.rb
gotime-cassandra_object-4.0.2 lib/cassandra_object/identity.rb
gotime-cassandra_object-4.0.1 lib/cassandra_object/identity.rb
gotime-cassandra_object-4.0.0 lib/cassandra_object/identity.rb
gotime-cassandra_object-3.0.5 lib/cassandra_object/identity.rb
gotime-cassandra_object-3.0.4 lib/cassandra_object/identity.rb
gotime-cassandra_object-3.0.3 lib/cassandra_object/identity.rb
gotime-cassandra_object-3.0.2 lib/cassandra_object/identity.rb
gotime-cassandra_object-3.0.1 lib/cassandra_object/identity.rb