Class: TwitterCldr::Tokenizers::TimeTokenizer

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

Constant Summary

Constants inherited from DateTimeTokenizer

DateTimeTokenizer::VALID_TYPES

Instance Attribute Summary

Attributes inherited from DateTimeTokenizer

#calendar_type, #placeholders

Attributes inherited from Base

#locale, #paths, #placeholders, #resource, #token_splitter_regex, #token_type_regexes, #type

Instance Method Summary collapse

Methods inherited from DateTimeTokenizer

#calendar, #tokens

Constructor Details

#initialize(options = {}) ⇒ TimeTokenizer

Returns a new instance of TimeTokenizer.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/twitter_cldr/tokenizers/calendars/time_tokenizer.rb', line 9

def initialize(options = {})
  super(options)
  @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 = [
      { :type => :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})/ },
      { :type => :plaintext, :regex => // }
  ]

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