Class: Spree::Core::QueryFilters::Comparable
- Inherits:
-
Object
- Object
- Spree::Core::QueryFilters::Comparable
- Defined in:
- lib/spree/core/query_filters/comparable.rb
Instance Method Summary collapse
- #call(scope:, filter:) ⇒ Object
-
#initialize(attribute:) ⇒ Comparable
constructor
A new instance of Comparable.
Constructor Details
#initialize(attribute:) ⇒ Comparable
Returns a new instance of Comparable.
5 6 7 |
# File 'lib/spree/core/query_filters/comparable.rb', line 5 def initialize(attribute:) @attribute = attribute end |
Instance Method Details
#call(scope:, filter:) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/spree/core/query_filters/comparable.rb', line 9 def call(scope:, filter:) scope = gt(scope, filter[:gt]) scope = gteq(scope, filter[:gteq]) scope = lt(scope, filter[:lt]) lteq(scope, filter[:lteq]) end |