Class: Textoken::Only
- Inherits:
-
Object
- Object
- Textoken::Only
- 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
Instance Attribute Summary
Attributes included from ConditionalOption
Instance Method Summary collapse
-
#tokenize(base) ⇒ Object
base.text is raw tokens splitted with ‘ ’ values are Regexps array to search base.findings, Findings object for pushing matching tokens.
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 |