Module: Card::Query::CardClass
- Included in:
- Card
- Defined in:
- card/lib/card/query/card_class.rb
Instance Method Summary collapse
-
#count_by_cql(spec) ⇒ Object
-
#find_each(**options, &block) ⇒ Object
-
#find_in_batches(**options) ⇒ Object
-
#search(spec, comment = nil, &block) ⇒ Object
Instance Method Details
#count_by_cql(spec) ⇒ Object
10 11 12 13 14 |
# File 'card/lib/card/query/card_class.rb', line 10 def count_by_cql spec spec = spec.clone spec.delete(:offset) search spec.merge(return: "count") end |
#find_each(**options, &block) ⇒ Object
16 17 18 19 20 21 22 |
# File 'card/lib/card/query/card_class.rb', line 16 def find_each **, &block # this is a copy from rails (3.2.16) and is needed because this # is performed by a relation (ActiveRecord::Relation) find_in_batches(**) do |records| records.each(&block) end end |
#find_in_batches(**options) ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'card/lib/card/query/card_class.rb', line 24 def find_in_batches ** if block_given? super do |records| yield(records) Card::Cache.reset_temp end else super end end |