Class: Textoken::Only

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

Overview

This option object selects words in text via matching regexp regexp should be defined in option_values.yml

Direct Known Subclasses

OnlyRegexp

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/only.rb', line 10

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