Sha256: ff46040cc7a3dcd89d4964a36c8cd6142fd7c0cbd20e6f735074c600a8c48c19

Contents?: true

Size: 382 Bytes

Versions: 3

Compression:

Stored size: 382 Bytes

Contents

class FuzzyMatch
  # A stop word is ignored
  class StopWord
    attr_reader :regexp
    
    def initialize(regexp_or_str)
      @regexp = regexp_or_str.to_regexp
    end
    
    # Destructively remove stop words from the string
    def apply!(str)
      str.gsub! regexp, ''
    end
    
    def inspect
      "#<FuzzyMatch::StopWord regexp=#{regexp.inspect}>"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fuzzy_match-1.3.1 lib/fuzzy_match/stop_word.rb
fuzzy_match-1.3.0 lib/fuzzy_match/stop_word.rb
fuzzy_match-1.2.2 lib/fuzzy_match/stop_word.rb