Sha256: 49b7c0b7138636856546dc80067f3ce487410448f94664a8fcfa4fb9aff6a46c

Contents?: true

Size: 616 Bytes

Versions: 11

Compression:

Stored size: 616 Bytes

Contents

module CassandraObject
  module Scoping
    extend ActiveSupport::Concern

    included do
      singleton_class.class_eval do
        delegate :find, :find_by_id, :first, :all, to: :scope
        delegate :find_each, :find_in_batches, to: :scope
        delegate :select, :where, to: :scope
      end
    end

    module ClassMethods
      def scope
        self.current_scope ||= Scope.new(self)
      end

      def current_scope
        Thread.current["#{self}_current_scope"]
      end

      def current_scope=(new_scope)
        Thread.current["#{self}_current_scope"] = new_scope
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
gotime-cassandra_object-4.11.6 lib/cassandra_object/scoping.rb
gotime-cassandra_object-4.11.5 lib/cassandra_object/scoping.rb
gotime-cassandra_object-4.11.4 lib/cassandra_object/scoping.rb
gotime-cassandra_object-4.11.3 lib/cassandra_object/scoping.rb
gotime-cassandra_object-4.11.2 lib/cassandra_object/scoping.rb
gotime-cassandra_object-4.11.1 lib/cassandra_object/scoping.rb
gotime-cassandra_object-4.11.0 lib/cassandra_object/scoping.rb
gotime-cassandra_object-4.10.5 lib/cassandra_object/scoping.rb
gotime-cassandra_object-4.10.4 lib/cassandra_object/scoping.rb
gotime-cassandra_object-4.10.3 lib/cassandra_object/scoping.rb
gotime-cassandra_object-4.10.2 lib/cassandra_object/scoping.rb