Class: TwitterCldr::Resources::GregorianCalendar

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter_cldr/resources/calendars_importer.rb

Constant Summary collapse

ERA_TAGS =
['eraNames', 'eraAbbr', 'eraNarrow'].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(locale, cldr_req) ⇒ GregorianCalendar

Returns a new instance of GregorianCalendar.



68
69
70
71
# File 'lib/twitter_cldr/resources/calendars_importer.rb', line 68

def initialize(locale, cldr_req)
  @locale = locale
  @cldr_req = cldr_req
end

Instance Attribute Details

#cldr_reqObject (readonly)

Returns the value of attribute cldr_req.



66
67
68
# File 'lib/twitter_cldr/resources/calendars_importer.rb', line 66

def cldr_req
  @cldr_req
end

#localeObject (readonly)

Returns the value of attribute locale.



66
67
68
# File 'lib/twitter_cldr/resources/calendars_importer.rb', line 66

def locale
  @locale
end

Instance Method Details

#to_hObject



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/twitter_cldr/resources/calendars_importer.rb', line 73

def to_h
  {
    calendars: {
      gregorian: {
        days:     contexts('day'),
        months:   contexts('month'),
        eras:     eras,
        quarters: contexts('quarter'),
        periods:  contexts('dayPeriod', group: "alt"),
        fields:   fields,
        formats: {
          date:     formats('date'),
          time:     formats('time'),
          datetime: formats('dateTime')
        },
        additional_formats: additional_formats
      }
    }
  }
end