Class: TwitterCldr::Tokenizers::TimeTokenizer

Inherits:
DateTimeTokenizer show all
Defined in:
lib/twitter_cldr/tokenizers/calendars/time_tokenizer.rb

Constant Summary collapse

TOKEN_SPLITTER_REGEX =
/(\'[\w\s-]+\'|a{1}|h{1,2}|H{1,2}|K{1,2}|k{1,2}|m{1,2}|s{1,2}|S+|z{1,4}|Z{1,4})/
TOKEN_TYPE_REGEXES =
{
  :pattern   => { :regex => /^(a{1}|h{1,2}|H{1,2}|K{1,2}|k{1,2}|m{1,2}|s{1,2}|S+|z{1,4}|Z{1,4})/, :priority => 1 },
  :plaintext => { :regex => //, :priority => 2 }
}

Constants inherited from DateTimeTokenizer

DateTimeTokenizer::DEFAULT_TYPE, DateTimeTokenizer::VALID_TYPES

Instance Attribute Summary

Attributes inherited from DateTimeTokenizer

#calendar_type, #placeholders

Attributes inherited from Base

#format, #locale, #paths, #placeholders, #resource, #token_splitter_regexes, #token_type_regexes, #type

Instance Method Summary collapse

Methods inherited from DateTimeTokenizer

#additional_format_selector, #calendar, #tokens

Constructor Details

#initialize(options = {}) ⇒ TimeTokenizer

Returns a new instance of TimeTokenizer.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/twitter_cldr/tokenizers/calendars/time_tokenizer.rb', line 15

def initialize(options = {})
  super(options)

  @token_splitter_regexes = {
    :else => TOKEN_SPLITTER_REGEX
  }

  @token_type_regexes = {
    :else => TOKEN_TYPE_REGEXES
  }

  @paths = {
    :default    => [:formats, :time, :default],
    :full       => [:formats, :time, :full],
    :long       => [:formats, :time, :long],
    :medium     => [:formats, :time, :medium],
    :short      => [:formats, :time, :short],
    :additional => [:additional_formats]
  }
end