Class: TwitterCldr::Formatters::DateTimeFormatter
- Defined in:
- lib/twitter_cldr/formatters/calendars/datetime_formatter.rb
Direct Known Subclasses
Constant Summary collapse
- WEEKDAY_KEYS =
[:sun, :mon, :tue, :wed, :thu, :fri, :sat]
- METHODS =
ignoring u, l, g, j, A
{ # ignoring u, l, g, j, A 'G' => :era, 'y' => :year, 'Y' => :year_of_week_of_year, 'Q' => :quarter, 'q' => :quarter_stand_alone, 'M' => :month, 'L' => :month_stand_alone, 'w' => :week_of_year, 'W' => :week_of_month, 'd' => :day, 'D' => :day_of_month, 'F' => :day_of_week_in_month, 'E' => :weekday, 'e' => :weekday_local, 'c' => :weekday_local_stand_alone, 'a' => :period, 'h' => :hour, 'H' => :hour, 'K' => :hour, 'k' => :hour, 'm' => :minute, 's' => :second, 'S' => :second_fraction, 'z' => :timezone, 'Z' => :timezone, 'v' => :timezone_generic_non_location, 'V' => :timezone_metazone }
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ DateTimeFormatter
constructor
A new instance of DateTimeFormatter.
- #result_for_token(token, index, date) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(options = {}) ⇒ DateTimeFormatter
Returns a new instance of DateTimeFormatter.
43 44 45 |
# File 'lib/twitter_cldr/formatters/calendars/datetime_formatter.rb', line 43 def initialize( = {}) @tokenizer = TwitterCldr::Tokenizers::DateTimeTokenizer.new(:locale => extract_locale(), :calendar_type => [:calendar_type]) end |
Instance Method Details
#result_for_token(token, index, date) ⇒ Object
47 48 49 |
# File 'lib/twitter_cldr/formatters/calendars/datetime_formatter.rb', line 47 def result_for_token(token, index, date) self.send(METHODS[token.value[0].chr], date, token.value, token.value.size) end |