Class: FluentQuery::Query
Overview
Instance Attribute Summary collapse
#connection
Instance Method Summary
collapse
#all, #assoc, #do, #each, #execute, #find_all, #map, #one, #processor, #single
Constructor Details
#initialize(connection) ⇒ Query
Returns a new instance of Query.
28
29
30
31
|
# File 'lib/fluent-query/query.rb', line 28
def initialize(connection)
super(connection)
@stack = [ ]
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/fluent-query/query.rb', line 38
def method_missing(sym, *args, &block)
driver = @connection.driver
_sym, args = driver.correct_token(sym, args)
self.push_token(_sym, args)
conditionally = driver.check_conditionally(self, sym, *args, &block)
if not conditionally.nil?
result = conditionally
else
result = self
end
return result
end
|
Instance Attribute Details
#stack ⇒ Object
Returns the value of attribute stack.
21
22
23
|
# File 'lib/fluent-query/query.rb', line 21
def stack
@stack
end
|
Instance Method Details
#build ⇒ Object
Also known as:
build!
88
89
90
|
# File 'lib/fluent-query/query.rb', line 88
def build
@connection.driver.build_query(self)
end
|
#compile ⇒ Object
Also known as:
compile!
#prepare ⇒ Object
Also known as:
prepare!
#push_token(name, arguments) ⇒ Object
59
60
61
|
# File 'lib/fluent-query/query.rb', line 59
def push_token(name, arguments)
@stack << FluentQuery::Token::new(name, arguments)
end
|
#query(*args) ⇒ Object
68
69
70
71
|
# File 'lib/fluent-query/query.rb', line 68
def query(*args)
@stack << FluentQuery::Tokens::Raw::new(args)
return self
end
|
#type ⇒ Object
79
80
81
|
# File 'lib/fluent-query/query.rb', line 79
def type
self.stack.first.name.to_sym
end
|