Class: BahaiDate::Year
- Inherits:
-
Object
- Object
- BahaiDate::Year
- Defined in:
- lib/bahai_date/year.rb
Direct Known Subclasses
Constant Summary collapse
- TITLES =
%w(Alif Ba Ab Dal Bab Vav Abad Jad Baha Hubb Bahhaj Javab Ahad Vahhab Vidad Badi Bahi Abha Vahid)
- TITLES_HTML =
%w(Alif Bá’ Ab Dál Báb Váv Abad Jád Bahá Ḥubb Bahháj Javáb Aḥad Vahháb Vidád Badí‘ Bahí Abhá Váḥid)
- TITLES_EN =
%w(A B Father D Gate V Eternity Generosity Splendour Love Delightful Answer Single Bountiful Affection Beginning Luminous Most Luminous Unity)
Instance Attribute Summary collapse
-
#bahai_era ⇒ Object
readonly
Returns the value of attribute bahai_era.
-
#kull_i_shay ⇒ Object
readonly
Returns the value of attribute kull_i_shay.
-
#months ⇒ Object
readonly
Returns the value of attribute months.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#vahid ⇒ Object
readonly
Returns the value of attribute vahid.
Instance Method Summary collapse
- #add_month(month_number) ⇒ Object
- #html ⇒ Object
-
#initialize(number_arg) ⇒ Year
constructor
A new instance of Year.
- #title ⇒ Object
- #to_s ⇒ Object
- #translation ⇒ Object
Constructor Details
#initialize(number_arg) ⇒ Year
Returns a new instance of Year.
9 10 11 12 13 14 |
# File 'lib/bahai_date/year.rb', line 9 def initialize(number_arg) validate number_arg @bahai_era = number_arg.to_i calculate_number_vahid_and_kull_i_shay @months = {} end |
Instance Attribute Details
#bahai_era ⇒ Object (readonly)
Returns the value of attribute bahai_era.
7 8 9 |
# File 'lib/bahai_date/year.rb', line 7 def bahai_era @bahai_era end |
#kull_i_shay ⇒ Object (readonly)
Returns the value of attribute kull_i_shay.
7 8 9 |
# File 'lib/bahai_date/year.rb', line 7 def kull_i_shay @kull_i_shay end |
#months ⇒ Object (readonly)
Returns the value of attribute months.
7 8 9 |
# File 'lib/bahai_date/year.rb', line 7 def months @months end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
7 8 9 |
# File 'lib/bahai_date/year.rb', line 7 def number @number end |
#vahid ⇒ Object (readonly)
Returns the value of attribute vahid.
7 8 9 |
# File 'lib/bahai_date/year.rb', line 7 def vahid @vahid end |
Instance Method Details
#add_month(month_number) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/bahai_date/year.rb', line 32 def add_month(month_number) if @months[month_number] @months[month_number] else @months[month_number] = Month.new(month_number) end end |
#html ⇒ Object
28 29 30 |
# File 'lib/bahai_date/year.rb', line 28 def html TITLES_HTML[title_index] end |
#title ⇒ Object
20 21 22 |
# File 'lib/bahai_date/year.rb', line 20 def title TITLES[title_index] end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/bahai_date/year.rb', line 16 def to_s @bahai_era.to_s end |
#translation ⇒ Object
24 25 26 |
# File 'lib/bahai_date/year.rb', line 24 def translation TITLES_EN[title_index] end |