Class: CassandraObject::Scope

Inherits:
Object
  • Object
show all
Includes:
Batches, FinderMethods, QueryMethods
Defined in:
lib/cassandra_object/scope.rb,
lib/cassandra_object/scope/batches.rb,
lib/cassandra_object/scope/query_methods.rb,
lib/cassandra_object/scope/finder_methods.rb

Defined Under Namespace

Modules: Batches, FinderMethods, QueryMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Batches

#find_each, #find_in_batches

Methods included from FinderMethods

#all, #find, #find_by_id, #first

Methods included from QueryMethods

#limit, #limit!, #select, #select!, #to_a, #where, #where!, #where_ids, #where_ids!

Constructor Details

#initialize(klass) ⇒ Scope

Returns a new instance of Scope.



12
13
14
15
16
17
18
19
# File 'lib/cassandra_object/scope.rb', line 12

def initialize(klass)
  @klass = klass

  @limit_value    = nil
  @select_values  = []
  @where_values   = []
  @id_values      = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args, &block) ⇒ Object (private)



30
31
32
33
34
35
36
37
38
# File 'lib/cassandra_object/scope.rb', line 30

def method_missing(method_name, *args, &block)
  if klass.respond_to?(method_name)
    scoping { klass.send(method_name, *args, &block) }
  elsif Array.method_defined?(method_name)
    to_a.send(method_name, *args, &block)
  else
    super
  end
end

Instance Attribute Details

#id_valuesObject

Returns the value of attribute id_values.



10
11
12
# File 'lib/cassandra_object/scope.rb', line 10

def id_values
  @id_values
end

#klassObject

Returns the value of attribute klass.



9
10
11
# File 'lib/cassandra_object/scope.rb', line 9

def klass
  @klass
end

#limit_valueObject

Returns the value of attribute limit_value.



10
11
12
# File 'lib/cassandra_object/scope.rb', line 10

def limit_value
  @limit_value
end

#select_valuesObject

Returns the value of attribute select_values.



10
11
12
# File 'lib/cassandra_object/scope.rb', line 10

def select_values
  @select_values
end

#where_valuesObject

Returns the value of attribute where_values.



10
11
12
# File 'lib/cassandra_object/scope.rb', line 10

def where_values
  @where_values
end