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
117 118 119 |
# File 'lib/attr_searchable_grammar/attributes.rb', line 117 def matches(value) super matches_value(value) end |
#matches_value(value) ⇒ Object
111 112 113 114 115 |
# File 'lib/attr_searchable_grammar/attributes.rb', line 111 def matches_value(value) return value.gsub(/\*/, "%") if ([:left_wildcard] != false && value.strip =~ /^[^*]+\*$|^\*[^*]+$/) || value.strip =~ /^[^*]+\*$/ [:left_wildcard] != false ? "%#{value}%" : "#{value}%" end |