Class: MundaneSearch::Filters::Base
- Inherits:
-
Object
- Object
- MundaneSearch::Filters::Base
- Defined in:
- lib/mundane-search/filters/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
- #apply? ⇒ Boolean
- #call ⇒ Object
- #filtered_collection ⇒ Object
- #filtered_params ⇒ Object
-
#initialize(collection, params = {}, options = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(collection, params = {}, options = {}) ⇒ Base
Returns a new instance of Base.
4 5 6 |
# File 'lib/mundane-search/filters/base.rb', line 4 def initialize(collection, params = {}, = {}) @collection, @params, @options = collection, params, end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
3 4 5 |
# File 'lib/mundane-search/filters/base.rb', line 3 def collection @collection end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/mundane-search/filters/base.rb', line 3 def @options end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'lib/mundane-search/filters/base.rb', line 3 def params @params end |
Instance Method Details
#apply? ⇒ Boolean
8 9 10 |
# File 'lib/mundane-search/filters/base.rb', line 8 def apply? true end |
#call ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/mundane-search/filters/base.rb', line 20 def call if apply? [filtered_collection, filtered_params] else [collection, params] end end |
#filtered_collection ⇒ Object
12 13 14 |
# File 'lib/mundane-search/filters/base.rb', line 12 def filtered_collection collection end |
#filtered_params ⇒ Object
16 17 18 |
# File 'lib/mundane-search/filters/base.rb', line 16 def filtered_params params end |