Class: Queries::Documentation::Filter
- Inherits:
-
Object
- Object
- Queries::Documentation::Filter
- Defined in:
- lib/queries/documentation/filter.rb
Overview
!! does not inherit from base query
Instance Attribute Summary collapse
-
#options ⇒ Object
General annotator options handling happens directly on the params as passed through to the controller, keep them together here.
-
#source_id ⇒ Object
Array, Integer.
Instance Method Summary collapse
- #all ⇒ ActiveRecord::Relation
- #and_clauses ⇒ ActiveRecord::Relation
-
#initialize(params) ⇒ Filter
constructor
A new instance of Filter.
- #table ⇒ Arel::Table
Constructor Details
#initialize(params) ⇒ Filter
Returns a new instance of Filter.
19 20 21 |
# File 'lib/queries/documentation/filter.rb', line 19 def initialize(params) @options = params end |
Instance Attribute Details
#options ⇒ Object
General annotator options handling happens directly on the params as passed through to the controller, keep them together here
11 12 13 |
# File 'lib/queries/documentation/filter.rb', line 11 def @options end |
#source_id ⇒ Object
Array, Integer
16 17 18 |
# File 'lib/queries/documentation/filter.rb', line 16 def source_id @source_id end |
Instance Method Details
#all ⇒ ActiveRecord::Relation
37 38 39 40 41 42 43 |
# File 'lib/queries/documentation/filter.rb', line 37 def all if a = and_clauses ::Documentation.where(and_clauses) else ::Documentation.all end end |
#and_clauses ⇒ ActiveRecord::Relation
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/queries/documentation/filter.rb', line 24 def and_clauses clauses = [ ::Queries::Annotator.annotator_params(, ::Documentation), ].compact a = clauses.shift clauses.each do |b| a = a.and(b) end a end |
#table ⇒ Arel::Table
46 47 48 |
# File 'lib/queries/documentation/filter.rb', line 46 def table ::Documentation.arel_table end |