Class: Spree::Core::QueryFilters::Comparable

Inherits:
Object
  • Object
show all
Defined in:
lib/spree/core/query_filters/comparable.rb

Direct Known Subclasses

Date, Number

Instance Method Summary collapse

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