Module: Riveter::Query
Defined Under Namespace
Classes: Base
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#query_filter ⇒ Object
readonly
Returns the value of attribute query_filter.
-
#relation ⇒ Object
readonly
Returns the value of attribute relation.
Instance Method Summary collapse
-
#find_each(&block) ⇒ Object
enumerates the resultset in batch mode.
-
#has_data? ⇒ Boolean
override if necessary in derived classes.
- #initialize(query_filter, options = {}) ⇒ Object
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/riveter/query.rb', line 6 def @options end |
#query_filter ⇒ Object (readonly)
Returns the value of attribute query_filter.
5 6 7 |
# File 'lib/riveter/query.rb', line 5 def query_filter @query_filter end |
#relation ⇒ Object (readonly)
Returns the value of attribute relation.
7 8 9 |
# File 'lib/riveter/query.rb', line 7 def relation @relation end |
Instance Method Details
#find_each(&block) ⇒ Object
enumerates the resultset in batch mode
16 17 18 |
# File 'lib/riveter/query.rb', line 16 def find_each(&block) relation.find_each_with_order(&block) if has_data? end |
#has_data? ⇒ Boolean
override if necessary in derived classes
21 22 23 |
# File 'lib/riveter/query.rb', line 21 def has_data? @has_data ||= relation.count() > 0 end |
#initialize(query_filter, options = {}) ⇒ Object
9 10 11 12 13 |
# File 'lib/riveter/query.rb', line 9 def initialize(query_filter, ={}) @query_filter = query_filter @options = @relation = build_relation(@query_filter) end |