Class: TwitterCldr::Shared::Calendar

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter_cldr/shared/calendar.rb

Constant Summary collapse

DEFAULT_FORMAT =
:'stand-alone'
NAMES_FORMS =
[:wide, :narrow, :abbreviated]

Instance Attribute Summary collapse

Instance Method Summary collapse

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_typeObject (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

#localeObject (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