Class: TwitterCldr::Tokenizers::DateTimeTokenizer
- Inherits:
-
Object
- Object
- TwitterCldr::Tokenizers::DateTimeTokenizer
- Defined in:
- lib/twitter_cldr/tokenizers/calendars/date_time_tokenizer.rb
Instance Attribute Summary collapse
-
#data_reader ⇒ Object
readonly
Returns the value of attribute data_reader.
Class Method Summary collapse
Instance Method Summary collapse
-
#full_tokenize(pattern) ⇒ Object
Tokenizes mixed date and time pattern strings, used to tokenize the additional date format patterns.
-
#initialize(data_reader) ⇒ DateTimeTokenizer
constructor
A new instance of DateTimeTokenizer.
- #tokenize(pattern) ⇒ Object
Constructor Details
#initialize(data_reader) ⇒ DateTimeTokenizer
Returns a new instance of DateTimeTokenizer.
23 24 25 |
# File 'lib/twitter_cldr/tokenizers/calendars/date_time_tokenizer.rb', line 23 def initialize(data_reader) @data_reader = data_reader end |
Instance Attribute Details
#data_reader ⇒ Object (readonly)
Returns the value of attribute data_reader.
21 22 23 |
# File 'lib/twitter_cldr/tokenizers/calendars/date_time_tokenizer.rb', line 21 def data_reader @data_reader end |
Class Method Details
.tokenizer ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/twitter_cldr/tokenizers/calendars/date_time_tokenizer.rb', line 11 def tokenizer @tokenizer ||= Tokenizer.new([ TokenRecognizer.new(:date, /\{\{date\}\}/), TokenRecognizer.new(:time, /\{\{time\}\}/), TokenRecognizer.new(:plaintext, /'.*'/), TokenRecognizer.new(:plaintext, //) ]) end |
Instance Method Details
#full_tokenize(pattern) ⇒ Object
Tokenizes mixed date and time pattern strings, used to tokenize the additional date format patterns.
35 36 37 |
# File 'lib/twitter_cldr/tokenizers/calendars/date_time_tokenizer.rb', line 35 def full_tokenize(pattern) PatternTokenizer.new(data_reader, full_tokenizer).tokenize(pattern) end |
#tokenize(pattern) ⇒ Object
27 28 29 30 31 |
# File 'lib/twitter_cldr/tokenizers/calendars/date_time_tokenizer.rb', line 27 def tokenize(pattern) ( PatternTokenizer.new(data_reader, tokenizer).tokenize(pattern) ) end |