Sha256: 5d9a6f30cc2ef8da5c983c9b0d3ab12b1f7a31e709ebf0382a505fc53e7e2e57

Contents?: true

Size: 370 Bytes

Versions: 4

Compression:

Stored size: 370 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
      "#<StopWord regexp=#{regexp.inspect}>"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fuzzy_match-1.2.1 lib/fuzzy_match/stop_word.rb
fuzzy_match-1.1.1 lib/fuzzy_match/stop_word.rb
fuzzy_match-1.1.0 lib/fuzzy_match/stop_word.rb
fuzzy_match-1.0.5 lib/fuzzy_match/stop_word.rb