Sha256: e0ca6b9e87f9ed89877921ea463b00bcacc6401ab66683ee0a52cd4e7eb05c7e
Contents?: true
Size: 1.67 KB
Versions: 4
Compression:
Stored size: 1.67 KB
Contents
# encoding: UTF-8 # Copyright 2012 Twitter, Inc # http://www.apache.org/licenses/LICENSE-2.0 module TwitterCldr module Js module Renderers module Data module Calendars class TimespanRenderer < TwitterCldr::Js::Renderers::Base def patterns [:ago, :until, :none].inject({}) do |final, direction| final[direction] = DataReaders::TimespanDataReader::VALID_UNITS.inject({}) do |unit_hash, unit| unit_hash[unit] = DataReaders::TimespanDataReader.all_types_for(locale, unit, direction).inject({}) do |type_hash, type| type_hash[type] = Formatters::Plurals::Rules.all_for(@locale).inject({}) do |rule_hash, rule| data_reader = DataReaders::TimespanDataReader.new( locale, 1, # the value doesn't matter since we provide :rule option :type => type, :direction => direction, :unit => unit, :rule => rule ) # rule_hash[rule] = data_reader.tokenizer.tokenize(data_reader.pattern).map(&:value) rule_hash[rule] = data_reader.pattern rule_hash end type_hash end unit_hash end final end end def get_data { :TimespanFormatter => { :patterns => patterns() } } end end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems