Class: RailsApiModel::Filters::BaseFilter
- Inherits:
-
Object
- Object
- RailsApiModel::Filters::BaseFilter
- Defined in:
- lib/rails_api_model/filters/base_filter.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#api_model ⇒ Object
readonly
Returns the value of attribute api_model.
-
#filter_key ⇒ Object
readonly
Returns the value of attribute filter_key.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #apply_scope(relation, key, value) ⇒ Object
- #ar_model ⇒ Object
-
#initialize(api_model, filter_key) ⇒ BaseFilter
constructor
A new instance of BaseFilter.
Constructor Details
#initialize(api_model, filter_key) ⇒ BaseFilter
Returns a new instance of BaseFilter.
6 7 8 9 |
# File 'lib/rails_api_model/filters/base_filter.rb', line 6 def initialize(api_model, filter_key) @api_model = api_model @filter_key = filter_key end |
Instance Attribute Details
#api_model ⇒ Object (readonly)
Returns the value of attribute api_model.
4 5 6 |
# File 'lib/rails_api_model/filters/base_filter.rb', line 4 def api_model @api_model end |
#filter_key ⇒ Object (readonly)
Returns the value of attribute filter_key.
4 5 6 |
# File 'lib/rails_api_model/filters/base_filter.rb', line 4 def filter_key @filter_key end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
15 16 17 18 |
# File 'lib/rails_api_model/filters/base_filter.rb', line 15 def ==(other) api_model == other.api_model && filter_key == other.filter_key end |
#apply_scope(relation, key, value) ⇒ Object
11 12 13 |
# File 'lib/rails_api_model/filters/base_filter.rb', line 11 def apply_scope(relation, key, value) raise 'Not implemented in the base class' end |
#ar_model ⇒ Object
22 23 24 |
# File 'lib/rails_api_model/filters/base_filter.rb', line 22 def ar_model api_model.ar_model end |