class TwitterCldr::Tokenizers::TokenRecognizer
Attributes
cleaner[R]
content[R]
regex[R]
token_type[R]
Public Class Methods
new(token_type, regex, content = nil, &block)
click to toggle source
# File lib/twitter_cldr/tokenizers/tokenizer.rb, line 13 def initialize(token_type, regex, content = nil, &block) @token_type = token_type @regex = regex @content = content @cleaner = block end
Public Instance Methods
clean(val)
click to toggle source
# File lib/twitter_cldr/tokenizers/tokenizer.rb, line 24 def clean(val) if cleaner cleaner.call(val) else val end end
recognizes?(text)
click to toggle source
# File lib/twitter_cldr/tokenizers/tokenizer.rb, line 20 def recognizes?(text) !!(text =~ regex) end