Sha256: bf4e8bde329f5b064f141caab5245a02510ffcfeec6daab80a32d1df4aa1a44b
Contents?: true
Size: 1.39 KB
Versions: 11
Compression:
Stored size: 1.39 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 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 = { :composite => { :regex => /^\#\{[^\}]+\}/, :content => /^\#\{([^\}]+)\}/, :priority => 1 }, :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})/, :priority => 2 }, :plaintext => { :regex => //, :priority => 3 } } def initialize(options = {}) super(options) @token_splitter_regexes = { :else => TOKEN_SPLITTER_REGEX } @token_type_regexes = { :else => TOKEN_TYPE_REGEXES } @paths = { :default => [:formats, :date, :default], :full => [:formats, :date, :full], :long => [:formats, :date, :long], :medium => [:formats, :date, :medium], :short => [:formats, :date, :short], :additional => [:additional_formats] } end protected # must override this because DateTimeTokenizer will set them otherwise def init_placeholders @placeholders = {} end end end end
Version data entries
11 entries across 11 versions & 1 rubygems