Class: ROM::Cassandra::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/rom/cassandra/query.rb

Overview

Wraps the external CQL query builder

Constant Summary collapse

DEFAULT_BUILDER =

Default CQL statements builder

QueryBuilder::CQL

Instance Method Summary collapse

Constructor Details

#initialize(query = nil) ⇒ Query

Initializes the object carrying the lazy query

Parameters:



18
19
20
# File 'lib/rom/cassandra/query.rb', line 18

def initialize(query = nil)
  @query = query || DEFAULT_BUILDER
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object (private)



36
37
38
39
# File 'lib/rom/cassandra/query.rb', line 36

def method_missing(name, *args)
  updated_query = @query.public_send(name, *args)
  self.class.new(updated_query)
end

Instance Method Details

#to_sString

Builds the Query statement from the wrapped query

Returns:

  • (String)


26
27
28
# File 'lib/rom/cassandra/query.rb', line 26

def to_s
  @query.to_s
end