Class: ProductGroupSearch::BaseField
- Inherits:
-
Object
- Object
- ProductGroupSearch::BaseField
- Defined in:
- lib/nimbleshop/product_group_search/base_field.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#condition ⇒ Object
Returns the value of attribute condition.
Instance Method Summary collapse
-
#initialize(condition) ⇒ BaseField
constructor
A new instance of BaseField.
- #valid_operator?(operator) ⇒ Boolean
- #where(proxy = nil) ⇒ Object
Constructor Details
#initialize(condition) ⇒ BaseField
Returns a new instance of BaseField.
6 7 8 |
# File 'lib/nimbleshop/product_group_search/base_field.rb', line 6 def initialize(condition) self.condition = condition end |
Instance Attribute Details
#condition ⇒ Object
Returns the value of attribute condition.
3 4 5 |
# File 'lib/nimbleshop/product_group_search/base_field.rb', line 3 def condition @condition end |
Instance Method Details
#valid_operator?(operator) ⇒ Boolean
10 11 12 |
# File 'lib/nimbleshop/product_group_search/base_field.rb', line 10 def valid_operator?(operator) valid_operators.include?(operator.to_s) end |
#where(proxy = nil) ⇒ Object
14 15 16 17 |
# File 'lib/nimbleshop/product_group_search/base_field.rb', line 14 def where(proxy = nil) clause = send(condition.operator, coerced_value) proxy ? proxy.and(clause) : clause end |