module Textoken::ConditionalOption

This module will be shared in options like, only and exclude

Attributes

base[R]
findings[R]
regexps[R]

Public Class Methods

new(values) click to toggle source
# File lib/textoken/options/modules/conditional_option.rb, line 12
def initialize(values)
  @regexps  = Searcher.new(values).regexps
  @findings = Findings.new
end

Public Instance Methods

priority() click to toggle source
# File lib/textoken/options/modules/conditional_option.rb, line 8
def priority
  1
end

Private Instance Methods

tokenize_if(&block) click to toggle source
# File lib/textoken/options/modules/conditional_option.rb, line 19
def tokenize_if(&block)
  regexps.each do |r|
    base.text.each_with_index do |w, i|
      findings.push(i, w) if block.call(w, r)
    end
  end
  findings.result
end