Class: TwitterCldr::Shared::Calendar
- Inherits:
-
Object
- Object
- TwitterCldr::Shared::Calendar
- Defined in:
- lib/twitter_cldr/shared/calendar.rb
Constant Summary collapse
- DEFAULT_FORMAT =
:'stand-alone'
- NAMES_FORMS =
[:wide, :narrow, :abbreviated]
Instance Attribute Summary collapse
-
#calendar_type ⇒ Object
readonly
Returns the value of attribute calendar_type.
-
#locale ⇒ Object
readonly
Returns the value of attribute locale.
Instance Method Summary collapse
-
#initialize(locale = TwitterCldr.get_locale, calendar_type = TwitterCldr::DEFAULT_CALENDAR_TYPE) ⇒ Calendar
constructor
A new instance of Calendar.
- #months(names_form = :wide) ⇒ Object
- #weekdays(names_form = :wide) ⇒ Object
Constructor Details
#initialize(locale = TwitterCldr.get_locale, calendar_type = TwitterCldr::DEFAULT_CALENDAR_TYPE) ⇒ Calendar
Returns a new instance of Calendar.
16 17 18 19 |
# File 'lib/twitter_cldr/shared/calendar.rb', line 16 def initialize(locale = TwitterCldr.get_locale, calendar_type = TwitterCldr::DEFAULT_CALENDAR_TYPE) @locale = TwitterCldr.convert_locale(locale) @calendar_type = calendar_type end |
Instance Attribute Details
#calendar_type ⇒ Object (readonly)
Returns the value of attribute calendar_type.
14 15 16 |
# File 'lib/twitter_cldr/shared/calendar.rb', line 14 def calendar_type @calendar_type end |
#locale ⇒ Object (readonly)
Returns the value of attribute locale.
14 15 16 |
# File 'lib/twitter_cldr/shared/calendar.rb', line 14 def locale @locale end |
Instance Method Details
#months(names_form = :wide) ⇒ Object
21 22 23 24 |
# File 'lib/twitter_cldr/shared/calendar.rb', line 21 def months(names_form = :wide) data = get_with_names_form(:months, names_form) data && data.sort_by{ |m| m.first }.map { |m| m.last } end |
#weekdays(names_form = :wide) ⇒ Object
26 27 28 |
# File 'lib/twitter_cldr/shared/calendar.rb', line 26 def weekdays(names_form = :wide) get_with_names_form(:days, names_form) end |