Class: ProductGroupSearch::TextField

Inherits:
BaseField
  • Object
show all
Defined in:
lib/nimbleshop/product_group_search/text_field.rb

Instance Attribute Summary

Attributes inherited from BaseField

#condition

Instance Method Summary collapse

Methods inherited from BaseField

#initialize, #valid_operator?, #where

Constructor Details

This class inherits a constructor from ProductGroupSearch::BaseField

Instance Method Details

#coerced_valueObject



25
26
27
# File 'lib/nimbleshop/product_group_search/text_field.rb', line 25

def coerced_value
  value.try(:to_s)
end

#contains(val) ⇒ Object



5
6
7
# File 'lib/nimbleshop/product_group_search/text_field.rb', line 5

def contains(val)
  matches("%#{val}%")
end

#ends(val) ⇒ Object



9
10
11
# File 'lib/nimbleshop/product_group_search/text_field.rb', line 9

def ends(val)
  matches("%#{val}")
end

#eq(val) ⇒ Object



17
18
19
# File 'lib/nimbleshop/product_group_search/text_field.rb', line 17

def eq(val)
  matches(val)
end

#starts(val) ⇒ Object



13
14
15
# File 'lib/nimbleshop/product_group_search/text_field.rb', line 13

def starts(val)
  matches("#{val}%")
end

#valid_operatorsObject



21
22
23
# File 'lib/nimbleshop/product_group_search/text_field.rb', line 21

def valid_operators
  %w(eq contains starts ends)
end

#valid_value_data_type?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/nimbleshop/product_group_search/text_field.rb', line 29

def valid_value_data_type?
  condition.value.present?
end