Class: Textoken::Exclude

Inherits:
Object
  • Object
show all
Includes:
ConditionalOption
Defined in:
lib/textoken/options/exclude.rb

Overview

This option object excludes words in text via matching regexp Non-excluded words pushed to findings array

Direct Known Subclasses

ExcludeRegexp

Instance Attribute Summary

Attributes included from ConditionalOption

#base, #findings, #regexps

Instance Method Summary collapse

Methods included from ConditionalOption

#initialize, #priority, #tokenize_if

Instance Method Details

#tokenize(base) ⇒ Object

base.text is raw tokens splitted with ‘ ’ values are Regexps array to search base.findings, Findings object for pushing matching tokens



10
11
12
13
# File 'lib/textoken/options/exclude.rb', line 10

def tokenize(base)
  @base = base
  tokenize_if { |word, regexp| !word.match(regexp) }
end