Sha256: e0b96a15f9d95f99b62e69dcda94f4a135cb9cc2266a5da215a4051b5c641e6c

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

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 => "calendars.gregorian.formats.time.default",
                   :full => "calendars.gregorian.formats.time.full",
                   :long => "calendars.gregorian.formats.time.long",
                   :medium => "calendars.gregorian.formats.time.medium",
                   :short => "calendars.gregorian.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

1 entries across 1 versions & 1 rubygems

Version Path
twitter_cldr-1.0.0 lib/tokenizers/calendars/time_tokenizer.rb