Class: AttrSearchableGrammar::Attributes::String
- Defined in:
- lib/attr_searchable_grammar/attributes.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#compatible?, #fulltext?, #initialize, #map, #method_missing, #respond_to?
Constructor Details
This class inherits a constructor from AttrSearchableGrammar::Attributes::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class AttrSearchableGrammar::Attributes::Base
Instance Method Details
#matches(value) ⇒ Object
128 129 130 |
# File 'lib/attr_searchable_grammar/attributes.rb', line 128 def matches(value) super matches_value(value) end |
#matches_value(value) ⇒ Object
122 123 124 125 126 |
# File 'lib/attr_searchable_grammar/attributes.rb', line 122 def matches_value(value) return value.gsub(/\*/, "%") if ([:left_wildcard] != false && value.strip =~ /^[^*]+\*$|^\*[^*]+$/) || value.strip =~ /^[^*]+\*$/ [:left_wildcard] != false ? "%#{value}%" : "#{value}%" end |