Class: CassandraObject::Scope

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

Defined Under Namespace

Modules: FinderMethods, QueryMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FinderMethods

#find, #find_all_in_batches, #find_by_id, #find_in_batches, #first

Methods included from QueryMethods

#columns, #cql_response, #execute, #execute_paged, #limit, #limit!, #select, #select!, #where, #where!, #where_ids, #where_ids!

Constructor Details

#initialize(klass) ⇒ Scope

Returns a new instance of Scope.



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

def initialize(klass)
  @klass = klass

  @is_all = false
  @limit_value = nil
  @raw_response = nil
  @select_values = []
  @id_values = []
  @where_values = []
  @next_cursor = nil
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



33
34
35
36
37
38
39
40
41
# File 'lib/cassandra_object/scope.rb', line 33

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)
    execute.send(method_name, *args, &block)
  else
    super
  end
end

Instance Attribute Details

#id_valuesObject

Returns the value of attribute id_values.



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

def id_values
  @id_values
end

#is_allObject

Returns the value of attribute is_all.



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

def is_all
  @is_all
end

#klassObject

Returns the value of attribute klass.



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

def klass
  @klass
end

#limit_valueObject

Returns the value of attribute limit_value.



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

def limit_value
  @limit_value
end

#next_cursorObject

Returns the value of attribute next_cursor.



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

def next_cursor
  @next_cursor
end

#raw_responseObject

Returns the value of attribute raw_response.



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

def raw_response
  @raw_response
end

#select_valuesObject

Returns the value of attribute select_values.



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

def select_values
  @select_values
end

#where_valuesObject

Returns the value of attribute where_values.



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

def where_values
  @where_values
end