Sha256: 8d8fa04703afcd55d2dc6531806e169bd8d597e410ffd374348e5aa80d19f7a0
Contents?: true
Size: 1.08 KB
Versions: 6
Compression:
Stored size: 1.08 KB
Contents
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 module TwitterCldr module Js module Renderers module Calendars class DateTimeRenderer < TwitterCldr::Js::Renderers::Base self.template_file = File.expand_path(File.join(File.dirname(__FILE__), "../..", "mustache/calendars/datetime.coffee")) def tokens tokens = {} { :date_time => TwitterCldr::Tokenizers::DateTimeTokenizer, :time => TwitterCldr::Tokenizers::TimeTokenizer, :date => TwitterCldr::Tokenizers::DateTokenizer }.each_pair do |name, const| tokenizer = const.new(:locale => @locale) tokens[name] = const::VALID_TYPES.inject({}) do |ret, type| ret[type] = tokenizer.tokens(:type => type).map(&:to_hash) ret end end tokens.to_json end def calendar TwitterCldr::Tokenizers::DateTimeTokenizer.new(:locale => @locale).calendar.to_json end end end end end end
Version data entries
6 entries across 6 versions & 2 rubygems