Sha256: 4585be7ebc54ed76a6f55f0e1a01fc2b32be5f72492893aa2aa029247adfb88a

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

# encoding: UTF-8

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

module TwitterCldr
  module Tokenizers
    class DateTokenizer < TwitterCldr::Tokenizers::DateTimeTokenizer
      def initialize(options = {})
        super(options)
        @token_splitter_regex = /(\s*\'[\w\s-]+\'\s*|G{1,5}|y+|Y+|Q{1,4}|q{1,5}|M{1,5}|L{1,5}|d{1,2}|F{1}|E{1,5}|e{1,5}|c{1,5})/
        @token_type_regexes = [{ :type => :pattern, :regex => /^(?:G{1,5}|y+|Y+|Q{1,4}|q{1,5}|M{1,5}|L{1,5}|d{1,2}|F{1}|E{1,5}|e{1,5}|c{1,5})/ },
                               { :type => :plaintext, :regex => // }]
        @paths = { :default => "calendars.gregorian.formats.date.default",
                   :full => "calendars.gregorian.formats.date.full",
                   :long => "calendars.gregorian.formats.date.long",
                   :medium => "calendars.gregorian.formats.date.medium",
                   :short => "calendars.gregorian.formats.date.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.1.0 lib/tokenizers/calendars/date_tokenizer.rb