class SearchCopGrammar::Attributes::String
Public Instance Methods
matches(value)
click to toggle source
Calls superclass method
# File lib/search_cop_grammar/attributes.rb, line 178 def matches(value) super matches_value(value) end
matches_value(value)
click to toggle source
# File lib/search_cop_grammar/attributes.rb, line 163 def matches_value(value) res = value.gsub(/[%_\\]/) { |char| "\\#{char}" } if value.strip =~ /^\*|\*$/ res = res.gsub(/^\*/, "%") if options[:left_wildcard] != false res = res.gsub(/\*$/, "%") if options[:right_wildcard] != false return res end res = "%#{res}" if options[:left_wildcard] != false res = "#{res}%" if options[:right_wildcard] != false res end