Sha256: cbdeae5c107fbb90a21695cacb554e68715ba62356df75e717a872abf31e953f

Contents?: true

Size: 380 Bytes

Versions: 3

Compression:

Stored size: 380 Bytes

Contents

class LooseTightDictionary
  # 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

3 entries across 3 versions & 1 rubygems

Version Path
loose_tight_dictionary-1.0.5 lib/loose_tight_dictionary/stop_word.rb
loose_tight_dictionary-1.0.4 lib/loose_tight_dictionary/stop_word.rb
loose_tight_dictionary-1.0.3 lib/loose_tight_dictionary/stop_word.rb