Sha256: 4e124cbce5c43343cfa116507e5249faed18a466cda532f604ea1f3000ec3fb4

Contents?: true

Size: 1.03 KB

Versions: 12

Compression:

Stored size: 1.03 KB

Contents

# encoding: UTF-8

# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0

module TwitterCldr
  module Tokenizers
    class TimeTokenizer < TwitterCldr::Tokenizers::DateTimeTokenizer
      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

      protected

      # must override this because DateTimeTokenizer will set them otherwise
      def init_placeholders
        @placeholders = {}
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
twitter_cldr-1.9.1 lib/twitter_cldr/tokenizers/calendars/time_tokenizer.rb
twitter_cldr-1.9.0 lib/twitter_cldr/tokenizers/calendars/time_tokenizer.rb
twitter_cldr-1.8.1 lib/twitter_cldr/tokenizers/calendars/time_tokenizer.rb
twitter_cldr-1.8.0 lib/twitter_cldr/tokenizers/calendars/time_tokenizer.rb
twitter_cldr-1.7.0 lib/twitter_cldr/tokenizers/calendars/time_tokenizer.rb
twitter_cldr-1.6.2 lib/twitter_cldr/tokenizers/calendars/time_tokenizer.rb
twitter_cldr-1.6.1 lib/twitter_cldr/tokenizers/calendars/time_tokenizer.rb
twitter_cldr-1.6.0 lib/twitter_cldr/tokenizers/calendars/time_tokenizer.rb
twitter_cldr-1.5.0 lib/twitter_cldr/tokenizers/calendars/time_tokenizer.rb
twitter_cldr-1.4.1 lib/twitter_cldr/tokenizers/calendars/time_tokenizer.rb
twitter_cldr-1.4.0 lib/twitter_cldr/tokenizers/calendars/time_tokenizer.rb
twitter_cldr-1.3.6 lib/twitter_cldr/tokenizers/calendars/time_tokenizer.rb