Method: Howzit::StringUtils#to_rx
- Defined in:
- lib/howzit/stringutils.rb
#to_rx ⇒ Regexp
Convert a string to a regex object based on matching settings
91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/howzit/stringutils.rb', line 91 def to_rx case Howzit.[:matching] when 'exact' /^#{self}$/i when 'beginswith' /^#{self}/i when 'fuzzy' /#{split(//).join('.{0,3}?')}/i else /#{self}/i end end |