bahai_date 1.4.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,140 +1,140 @@
1
1
  module BahaiDate
2
2
  class OccasionFactory
3
3
  OCCASIONS = {
4
- ayyam_i_ha_1: { type: :ayyam_i_ha, work_suspended: false, title: 'First day of Ayyam-i-Ha (Intercalery Days)', short_title: '1st day of Ayyam-i-Ha', title_html: 'First day of Ayyám-i-Há (Intercalery Days)', short_title_html: '1<sup>st</sup> day of Ayyám-i-Há' },
5
- ayyam_i_ha_2: { type: :ayyam_i_ha, work_suspended: false, title: 'Second day of Ayyam-i-Ha (Intercalery Days)', short_title: '2nd day of Ayyam-i-Ha', title_html: 'Second day of Ayyám-i-Há (Intercalery Days)', short_title_html: '2<sup>nd</sup> day of Ayyám-i-Há' },
6
- ayyam_i_ha_3: { type: :ayyam_i_ha, work_suspended: false, title: 'Third day of Ayyam-i-Ha (Intercalery Days)', short_title: '3rd day of Ayyam-i-Ha', title_html: 'Third day of Ayyám-i-Há (Intercalery Days)', short_title_html: '3<sup>rd</sup> day of Ayyám-i-Há' },
7
- ayyam_i_ha_4: { type: :ayyam_i_ha, work_suspended: false, title: 'Fourth day of Ayyam-i-Ha (Intercalery Days)', short_title: '4th day of Ayyam-i-Ha', title_html: 'Fourth day of Ayyám-i-Há (Intercalery Days)', short_title_html: '4<sup>th</sup> day of Ayyám-i-Há' },
8
- ayyam_i_ha_5: { type: :ayyam_i_ha, work_suspended: false, title: 'Fifth day of Ayyam-i-Ha (Intercalery Days)', short_title: '5th day of Ayyam-i-Ha', title_html: 'Fifth day of Ayyám-i-Há (Intercalery Days)', short_title_html: '5<sup>th</sup> day of Ayyám-i-Há' },
9
- fasting_1: { type: :fasting, work_suspended: false, title: 'First day of the period of Fasting', short_title: '1st day of Fasting', title_html: 'First day of the period of Fasting', short_title_html: '1<sup>st</sup> day of Fasting' },
10
- fasting_2: { type: :fasting, work_suspended: false, title: 'Second day of the period of Fasting', short_title: '2nd day of Fasting', title_html: 'Second day of the period of Fasting', short_title_html: '2<sup>nd</sup> day of Fasting' },
11
- fasting_3: { type: :fasting, work_suspended: false, title: 'Third day of the period of Fasting', short_title: '3rd day of Fasting', title_html: 'Third day of the period of Fasting', short_title_html: '3<sup>rd</sup> day of Fasting' },
12
- fasting_4: { type: :fasting, work_suspended: false, title: 'Fourth day of the period of Fasting', short_title: '4th day of Fasting', title_html: 'Fourth day of the period of Fasting', short_title_html: '4<sup>th</sup> day of Fasting' },
13
- fasting_5: { type: :fasting, work_suspended: false, title: 'Fifth day of the period of Fasting', short_title: '5th day of Fasting', title_html: 'Fifth day of the period of Fasting', short_title_html: '5<sup>th</sup> day of Fasting' },
14
- fasting_6: { type: :fasting, work_suspended: false, title: 'Sixth day of the period of Fasting', short_title: '6th day of Fasting', title_html: 'Sixth day of the period of Fasting', short_title_html: '6<sup>th</sup> day of Fasting' },
15
- fasting_7: { type: :fasting, work_suspended: false, title: 'Seventh day of the period of Fasting', short_title: '7th day of Fasting', title_html: 'Seventh day of the period of Fasting', short_title_html: '7<sup>th</sup> day of Fasting' },
16
- fasting_8: { type: :fasting, work_suspended: false, title: 'Eighth day of the period of Fasting', short_title: '8th day of Fasting', title_html: 'Eighth day of the period of Fasting', short_title_html: '8<sup>th</sup> day of Fasting' },
17
- fasting_9: { type: :fasting, work_suspended: false, title: 'Ninth day of the period of Fasting', short_title: '9th day of Fasting', title_html: 'Ninth day of the period of Fasting', short_title_html: '9<sup>th</sup> day of Fasting' },
18
- fasting_10: { type: :fasting, work_suspended: false, title: 'Tenth day of the period of Fasting', short_title: '10th day of Fasting', title_html: 'Tenth day of the period of Fasting', short_title_html: '10<sup>th</sup> day of Fasting' },
19
- fasting_11: { type: :fasting, work_suspended: false, title: 'Eleventh day of the period of Fasting', short_title: '11th day of Fasting', title_html: 'Eleventh day of the period of Fasting', short_title_html: '11<sup>th</sup> day of Fasting' },
20
- fasting_12: { type: :fasting, work_suspended: false, title: 'Twelfth day of the period of Fasting', short_title: '12th day of Fasting', title_html: 'Twelfth day of the period of Fasting', short_title_html: '12<sup>th</sup> day of Fasting' },
21
- fasting_13: { type: :fasting, work_suspended: false, title: 'Thirteenth day of the period of Fasting', short_title: '13th day of Fasting', title_html: 'Thirteenth day of the period of Fasting', short_title_html: '13<sup>th</sup> day of Fasting' },
22
- fasting_14: { type: :fasting, work_suspended: false, title: 'Fourteenth day of the period of Fasting', short_title: '14th day of Fasting', title_html: 'Fourteenth day of the period of Fasting', short_title_html: '14<sup>th</sup> day of Fasting' },
23
- fasting_15: { type: :fasting, work_suspended: false, title: 'Fifteenth day of the period of Fasting', short_title: '15th day of Fasting', title_html: 'Fifteenth day of the period of Fasting', short_title_html: '15<sup>th</sup> day of Fasting' },
24
- fasting_16: { type: :fasting, work_suspended: false, title: 'Sixteenth day of the period of Fasting', short_title: '16th day of Fasting', title_html: 'Sixteenth day of the period of Fasting', short_title_html: '16<sup>th</sup> day of Fasting' },
25
- fasting_17: { type: :fasting, work_suspended: false, title: 'Seventeenth day of the period of Fasting', short_title: '17th day of Fasting', title_html: 'Seventeenth day of the period of Fasting', short_title_html: '17<sup>th</sup> day of Fasting' },
26
- fasting_18: { type: :fasting, work_suspended: false, title: 'Eighteenth day of the period of Fasting', short_title: '18th day of Fasting', title_html: 'Eighteenth day of the period of Fasting', short_title_html: '18<sup>th</sup> day of Fasting' },
27
- fasting_19: { type: :fasting, work_suspended: false, title: 'Nineteenth day of the period of Fasting', short_title: '19th day of Fasting', title_html: 'Nineteenth day of the period of Fasting', short_title_html: '19<sup>th</sup> day of Fasting' },
28
- feast_1: { type: :feast, work_suspended: false, title: 'Nineteen Day Feast of the month of Baha (Splendour)', short_title: 'Feast of Baha', title_html: 'Nineteen Day Feast of the month of Bahá (Splendour)', short_title_html: 'Feast of Bahá' },
29
- feast_2: { type: :feast, work_suspended: false, title: 'Nineteen Day Feast of the month of Jalal (Glory)', short_title: 'Feast of Jalal', title_html: 'Nineteen Day Feast of the month of Jalál (Glory)', short_title_html: 'Feast of Jalál' },
30
- feast_3: { type: :feast, work_suspended: false, title: 'Nineteen Day Feast of the month of Jamal (Beauty)', short_title: 'Feast of Jamal', title_html: 'Nineteen Day Feast of the month of Jamál (Beauty)', short_title_html: 'Feast of Jamál' },
31
- feast_4: { type: :feast, work_suspended: false, title: 'Nineteen Day Feast of the month of Azamat (Grandeur)', short_title: 'Feast of Azamat', title_html: 'Nineteen Day Feast of the month of ‘Aẓamat (Grandeur)', short_title_html: 'Feast of ‘Aẓamat' },
32
- feast_5: { type: :feast, work_suspended: false, title: 'Nineteen Day Feast of the month of Nur (Light)', short_title: 'Feast of Nur', title_html: 'Nineteen Day Feast of the month of Núr (Light)', short_title_html: 'Feast of Núr' },
33
- feast_6: { type: :feast, work_suspended: false, title: 'Nineteen Day Feast of the month of Rahmat (Mercy)', short_title: 'Feast of Rahmat', title_html: 'Nineteen Day Feast of the month of Raḥmat (Mercy)', short_title_html: 'Feast of Raḥmat' },
34
- feast_7: { type: :feast, work_suspended: false, title: 'Nineteen Day Feast of the month of Kalimat (Words)', short_title: 'Feast of Kalimat', title_html: 'Nineteen Day Feast of the month of Kalimát (Words)', short_title_html: 'Feast of Kalimát' },
35
- feast_8: { type: :feast, work_suspended: false, title: 'Nineteen Day Feast of the month of Kamal (Perfection)', short_title: 'Feast of Kamal', title_html: 'Nineteen Day Feast of the month of Kamál (Perfection)', short_title_html: 'Feast of Kamál' },
36
- feast_9: { type: :feast, work_suspended: false, title: 'Nineteen Day Feast of the month of Asma (Names)', short_title: 'Feast of Asma', title_html: 'Nineteen Day Feast of the month of Asmá’ (Names)', short_title_html: 'Feast of Asmá’' },
37
- feast_10: { type: :feast, work_suspended: false, title: 'Nineteen Day Feast of the month of Izzat (Might)', short_title: 'Feast of Izzat', title_html: 'Nineteen Day Feast of the month of ‘Izzat (Might)', short_title_html: 'Feast of ‘Izzat' },
38
- feast_11: { type: :feast, work_suspended: false, title: 'Nineteen Day Feast of the month of Mashiyyat (Will)', short_title: 'Feast of Mashiyyat', title_html: 'Nineteen Day Feast of the month of Ma<u>sh</u>íyyat (Will)', short_title_html: 'Feast of Ma<u>sh</u>íyyat' },
39
- feast_12: { type: :feast, work_suspended: false, title: 'Nineteen Day Feast of the month of Ilm (Knowledge)', short_title: 'Feast of Ilm', title_html: 'Nineteen Day Feast of the month of ‘Ilm (Knowledge)', short_title_html: 'Feast of ‘Ilm' },
40
- feast_13: { type: :feast, work_suspended: false, title: 'Nineteen Day Feast of the month of Qudrat (Power)', short_title: 'Feast of Qudrat', title_html: 'Nineteen Day Feast of the month of Qudrat (Power)', short_title_html: 'Feast of Qudrat' },
41
- feast_14: { type: :feast, work_suspended: false, title: 'Nineteen Day Feast of the month of Qawl (Speech)', short_title: 'Feast of Qawl', title_html: 'Nineteen Day Feast of the month of Qawl (Speech)', short_title_html: 'Feast of Qawl' },
42
- feast_15: { type: :feast, work_suspended: false, title: 'Nineteen Day Feast of the month of Masail (Questions)', short_title: 'Feast of Masail', title_html: 'Nineteen Day Feast of the month of Masá’il (Questions)', short_title_html: 'Feast of Masá’il' },
43
- feast_16: { type: :feast, work_suspended: false, title: 'Nineteen Day Feast of the month of Sharaf (Honour)', short_title: 'Feast of Sharaf', title_html: 'Nineteen Day Feast of the month of <u>Sh</u>araf (Honour)', short_title_html: 'Feast of <u>Sh</u>araf' },
44
- feast_17: { type: :feast, work_suspended: false, title: 'Nineteen Day Feast of the month of Sultan (Sovereignty)', short_title: 'Feast of Sultan', title_html: 'Nineteen Day Feast of the month of Sulṭán (Sovereignty)', short_title_html: 'Feast of Sulṭán' },
45
- feast_18: { type: :feast, work_suspended: false, title: 'Nineteen Day Feast of the month of Mulk (Dominion)', short_title: 'Feast of Mulk', title_html: 'Nineteen Day Feast of the month of Mulk (Dominion)', short_title_html: 'Feast of Mulk' },
46
- feast_19: { type: :feast, work_suspended: false, title: 'Nineteen Day Feast of the month of Ala (Loftiness)', short_title: 'Feast of Ala', title_html: 'Nineteen Day Feast of the month of ‘Alá’ (Loftiness)', short_title_html: 'Feast of ‘Alá’' },
47
- ridvan_1: { type: :holy, work_suspended: true, title: 'First day of the Festival of Ridvan', short_title: '1st day of Ridvan', title_html: 'First day of the Festival of Riḍván', short_title_html: '1<sup>st</sup> day of Riḍván' },
48
- ridvan_2: { type: :ridvan, work_suspended: false, title: 'Second day of the Festival of Ridvan', short_title: '2nd day of Ridvan', title_html: 'Second day of the Festival of Riḍván', short_title_html: '2<sup>nd</sup> day of Riḍván' },
49
- ridvan_3: { type: :ridvan, work_suspended: false, title: 'Third day of the Festival of Ridvan', short_title: '3rd day of Ridvan', title_html: 'Third day of the Festival of Riḍván', short_title_html: '3<sup>rd</sup> day of Riḍván' },
50
- ridvan_4: { type: :ridvan, work_suspended: false, title: 'Fourth day of the Festival of Ridvan', short_title: '4th day of Ridvan', title_html: 'Fourth day of the Festival of Riḍván', short_title_html: '4<sup>th</sup> day of Riḍván' },
51
- ridvan_5: { type: :ridvan, work_suspended: false, title: 'Fifth day of the Festival of Ridvan', short_title: '5th day of Ridvan', title_html: 'Fifth day of the Festival of Riḍván', short_title_html: '5<sup>th</sup> day of Riḍván' },
52
- ridvan_6: { type: :ridvan, work_suspended: false, title: 'Sixth day of the Festival of Ridvan', short_title: '6th day of Ridvan', title_html: 'Sixth day of the Festival of Riḍván', short_title_html: '6<sup>th</sup> day of Riḍván' },
53
- ridvan_7: { type: :ridvan, work_suspended: false, title: 'Seventh day of the Festival of Ridvan', short_title: '7th day of Ridvan', title_html: 'Seventh day of the Festival of Riḍván', short_title_html: '7<sup>th</sup> day of Riḍván' },
54
- ridvan_8: { type: :ridvan, work_suspended: false, title: 'Eighth day of the Festival of Ridvan', short_title: '8th day of Ridvan', title_html: 'Eighth day of the Festival of Riḍván', short_title_html: '8<sup>th</sup> day of Riḍván' },
55
- ridvan_9: { type: :holy, work_suspended: true, title: 'Ninth day of the Festival of Ridvan', short_title: '9th day of Ridvan', title_html: 'Ninth day of the Festival of Riḍván', short_title_html: '9<sup>th</sup> day of Riḍván' },
56
- ridvan_10: { type: :ridvan, work_suspended: false, title: 'Tenth day of the Festival of Ridvan', short_title: '10th day of Ridvan', title_html: 'Tenth day of the Festival of Riḍván', short_title_html: '10<sup>th</sup> day of Riḍván' },
57
- ridvan_11: { type: :ridvan, work_suspended: false, title: 'Eleventh day of the Festival of Ridvan', short_title: '11th day of Ridvan', title_html: 'Eleventh day of the Festival of Riḍván', short_title_html: '11<sup>th</sup> day of Riḍván' },
58
- ridvan_12: { type: :holy, work_suspended: true, title: 'Twelfth day of the Festival of Ridvan', short_title: '12th day of Ridvan', title_html: 'Twelfth day of the Festival of Riḍván', short_title_html: '12<sup>th</sup> day of Riḍván' },
59
- nawruz: { type: :holy, work_suspended: true, title: 'Naw-Ruz (New Year)', short_title: 'Naw-Ruz', title_html: 'Naw-Rúz (New Year)', short_title_html: 'Naw-Rúz' },
60
- declaration_bab: { type: :holy, work_suspended: true, title: 'Declaration of the Bab', short_title: 'Declaration of the Bab', title_html: 'Declaration of the Báb', short_title_html: 'Declaration of the Báb' },
61
- ascension_bahaullah: { type: :holy, work_suspended: true, title: "Ascension of Baha'u'llah", short_title: "Ascension of Baha'u'llah", title_html: 'Ascension of Bahá’u’lláh', short_title_html: 'Ascension of Bahá’u’lláh' },
62
- martyrdom_bab: { type: :holy, work_suspended: true, title: 'Martyrdom of the Bab', short_title: 'Martyrdom of the Bab', title_html: 'Martyrdom of the Báb', short_title_html: 'Martyrdom of the Báb' },
63
- birth_bab: { type: :holy, work_suspended: true, title: 'Anniversary of the Birth of the Bab', short_title: 'Birth of the Bab', title_html: 'Anniversary of the Birth of the Báb', short_title_html: 'Birth of the Báb' },
64
- birth_bahaullah: { type: :holy, work_suspended: true, title: "Anniversary of the Birth of Baha'u'llah", short_title: "Birth of Baha'u'llah", title_html: 'Anniversary of the Birth of Bahá’u’lláh', short_title_html: 'Birth of Bahá’u’lláh' },
65
- covenant: { type: :holy, work_suspended: false, title: 'Day of the Covenant', short_title: 'Day of the Covenant', title_html: 'Day of the Covenant', short_title_html: 'Day of the Covenant' },
66
- ascension_abdulbaha: { type: :holy, work_suspended: false, title: "Ascension of Abdu'l-Baha", short_title: "Ascension of Abdu'l-Baha", title_html: 'Ascension of ‘Abdu’l-Bahá', short_title_html: 'Ascension of ‘Abdu’l-Bahá' }
4
+ ayyam_i_ha_1: {type: :ayyam_i_ha, work_suspended: false, title: "First day of Ayyam-i-Ha (Intercalary Days)", short_title: "1st day of Ayyam-i-Ha", title_html: "First day of Ayyám-i-Há (Intercalary Days)", short_title_html: "1<sup>st</sup> day of Ayyám-i-Há"},
5
+ ayyam_i_ha_2: {type: :ayyam_i_ha, work_suspended: false, title: "Second day of Ayyam-i-Ha (Intercalary Days)", short_title: "2nd day of Ayyam-i-Ha", title_html: "Second day of Ayyám-i-Há (Intercalary Days)", short_title_html: "2<sup>nd</sup> day of Ayyám-i-Há"},
6
+ ayyam_i_ha_3: {type: :ayyam_i_ha, work_suspended: false, title: "Third day of Ayyam-i-Ha (Intercalary Days)", short_title: "3rd day of Ayyam-i-Ha", title_html: "Third day of Ayyám-i-Há (Intercalary Days)", short_title_html: "3<sup>rd</sup> day of Ayyám-i-Há"},
7
+ ayyam_i_ha_4: {type: :ayyam_i_ha, work_suspended: false, title: "Fourth day of Ayyam-i-Ha (Intercalary Days)", short_title: "4th day of Ayyam-i-Ha", title_html: "Fourth day of Ayyám-i-Há (Intercalary Days)", short_title_html: "4<sup>th</sup> day of Ayyám-i-Há"},
8
+ ayyam_i_ha_5: {type: :ayyam_i_ha, work_suspended: false, title: "Fifth day of Ayyam-i-Ha (Intercalary Days)", short_title: "5th day of Ayyam-i-Ha", title_html: "Fifth day of Ayyám-i-Há (Intercalary Days)", short_title_html: "5<sup>th</sup> day of Ayyám-i-Há"},
9
+ fasting_1: {type: :fasting, work_suspended: false, title: "First day of the period of Fasting", short_title: "1st day of Fasting", title_html: "First day of the period of Fasting", short_title_html: "1<sup>st</sup> day of Fasting"},
10
+ fasting_2: {type: :fasting, work_suspended: false, title: "Second day of the period of Fasting", short_title: "2nd day of Fasting", title_html: "Second day of the period of Fasting", short_title_html: "2<sup>nd</sup> day of Fasting"},
11
+ fasting_3: {type: :fasting, work_suspended: false, title: "Third day of the period of Fasting", short_title: "3rd day of Fasting", title_html: "Third day of the period of Fasting", short_title_html: "3<sup>rd</sup> day of Fasting"},
12
+ fasting_4: {type: :fasting, work_suspended: false, title: "Fourth day of the period of Fasting", short_title: "4th day of Fasting", title_html: "Fourth day of the period of Fasting", short_title_html: "4<sup>th</sup> day of Fasting"},
13
+ fasting_5: {type: :fasting, work_suspended: false, title: "Fifth day of the period of Fasting", short_title: "5th day of Fasting", title_html: "Fifth day of the period of Fasting", short_title_html: "5<sup>th</sup> day of Fasting"},
14
+ fasting_6: {type: :fasting, work_suspended: false, title: "Sixth day of the period of Fasting", short_title: "6th day of Fasting", title_html: "Sixth day of the period of Fasting", short_title_html: "6<sup>th</sup> day of Fasting"},
15
+ fasting_7: {type: :fasting, work_suspended: false, title: "Seventh day of the period of Fasting", short_title: "7th day of Fasting", title_html: "Seventh day of the period of Fasting", short_title_html: "7<sup>th</sup> day of Fasting"},
16
+ fasting_8: {type: :fasting, work_suspended: false, title: "Eighth day of the period of Fasting", short_title: "8th day of Fasting", title_html: "Eighth day of the period of Fasting", short_title_html: "8<sup>th</sup> day of Fasting"},
17
+ fasting_9: {type: :fasting, work_suspended: false, title: "Ninth day of the period of Fasting", short_title: "9th day of Fasting", title_html: "Ninth day of the period of Fasting", short_title_html: "9<sup>th</sup> day of Fasting"},
18
+ fasting_10: {type: :fasting, work_suspended: false, title: "Tenth day of the period of Fasting", short_title: "10th day of Fasting", title_html: "Tenth day of the period of Fasting", short_title_html: "10<sup>th</sup> day of Fasting"},
19
+ fasting_11: {type: :fasting, work_suspended: false, title: "Eleventh day of the period of Fasting", short_title: "11th day of Fasting", title_html: "Eleventh day of the period of Fasting", short_title_html: "11<sup>th</sup> day of Fasting"},
20
+ fasting_12: {type: :fasting, work_suspended: false, title: "Twelfth day of the period of Fasting", short_title: "12th day of Fasting", title_html: "Twelfth day of the period of Fasting", short_title_html: "12<sup>th</sup> day of Fasting"},
21
+ fasting_13: {type: :fasting, work_suspended: false, title: "Thirteenth day of the period of Fasting", short_title: "13th day of Fasting", title_html: "Thirteenth day of the period of Fasting", short_title_html: "13<sup>th</sup> day of Fasting"},
22
+ fasting_14: {type: :fasting, work_suspended: false, title: "Fourteenth day of the period of Fasting", short_title: "14th day of Fasting", title_html: "Fourteenth day of the period of Fasting", short_title_html: "14<sup>th</sup> day of Fasting"},
23
+ fasting_15: {type: :fasting, work_suspended: false, title: "Fifteenth day of the period of Fasting", short_title: "15th day of Fasting", title_html: "Fifteenth day of the period of Fasting", short_title_html: "15<sup>th</sup> day of Fasting"},
24
+ fasting_16: {type: :fasting, work_suspended: false, title: "Sixteenth day of the period of Fasting", short_title: "16th day of Fasting", title_html: "Sixteenth day of the period of Fasting", short_title_html: "16<sup>th</sup> day of Fasting"},
25
+ fasting_17: {type: :fasting, work_suspended: false, title: "Seventeenth day of the period of Fasting", short_title: "17th day of Fasting", title_html: "Seventeenth day of the period of Fasting", short_title_html: "17<sup>th</sup> day of Fasting"},
26
+ fasting_18: {type: :fasting, work_suspended: false, title: "Eighteenth day of the period of Fasting", short_title: "18th day of Fasting", title_html: "Eighteenth day of the period of Fasting", short_title_html: "18<sup>th</sup> day of Fasting"},
27
+ fasting_19: {type: :fasting, work_suspended: false, title: "Nineteenth day of the period of Fasting", short_title: "19th day of Fasting", title_html: "Nineteenth day of the period of Fasting", short_title_html: "19<sup>th</sup> day of Fasting"},
28
+ feast_1: {type: :feast, work_suspended: false, title: "Nineteen Day Feast of the month of Baha (Splendour)", short_title: "Feast of Baha", title_html: "Nineteen Day Feast of the month of Bahá (Splendour)", short_title_html: "Feast of Bahá"},
29
+ feast_2: {type: :feast, work_suspended: false, title: "Nineteen Day Feast of the month of Jalal (Glory)", short_title: "Feast of Jalal", title_html: "Nineteen Day Feast of the month of Jalál (Glory)", short_title_html: "Feast of Jalál"},
30
+ feast_3: {type: :feast, work_suspended: false, title: "Nineteen Day Feast of the month of Jamal (Beauty)", short_title: "Feast of Jamal", title_html: "Nineteen Day Feast of the month of Jamál (Beauty)", short_title_html: "Feast of Jamál"},
31
+ feast_4: {type: :feast, work_suspended: false, title: "Nineteen Day Feast of the month of Azamat (Grandeur)", short_title: "Feast of Azamat", title_html: "Nineteen Day Feast of the month of ‘Aẓamat (Grandeur)", short_title_html: "Feast of ‘Aẓamat"},
32
+ feast_5: {type: :feast, work_suspended: false, title: "Nineteen Day Feast of the month of Nur (Light)", short_title: "Feast of Nur", title_html: "Nineteen Day Feast of the month of Núr (Light)", short_title_html: "Feast of Núr"},
33
+ feast_6: {type: :feast, work_suspended: false, title: "Nineteen Day Feast of the month of Rahmat (Mercy)", short_title: "Feast of Rahmat", title_html: "Nineteen Day Feast of the month of Raḥmat (Mercy)", short_title_html: "Feast of Raḥmat"},
34
+ feast_7: {type: :feast, work_suspended: false, title: "Nineteen Day Feast of the month of Kalimat (Words)", short_title: "Feast of Kalimat", title_html: "Nineteen Day Feast of the month of Kalimát (Words)", short_title_html: "Feast of Kalimát"},
35
+ feast_8: {type: :feast, work_suspended: false, title: "Nineteen Day Feast of the month of Kamal (Perfection)", short_title: "Feast of Kamal", title_html: "Nineteen Day Feast of the month of Kamál (Perfection)", short_title_html: "Feast of Kamál"},
36
+ feast_9: {type: :feast, work_suspended: false, title: "Nineteen Day Feast of the month of Asma (Names)", short_title: "Feast of Asma", title_html: "Nineteen Day Feast of the month of Asmá’ (Names)", short_title_html: "Feast of Asmá’"},
37
+ feast_10: {type: :feast, work_suspended: false, title: "Nineteen Day Feast of the month of Izzat (Might)", short_title: "Feast of Izzat", title_html: "Nineteen Day Feast of the month of ‘Izzat (Might)", short_title_html: "Feast of ‘Izzat"},
38
+ feast_11: {type: :feast, work_suspended: false, title: "Nineteen Day Feast of the month of Mashiyyat (Will)", short_title: "Feast of Mashiyyat", title_html: "Nineteen Day Feast of the month of Ma<u>sh</u>íyyat (Will)", short_title_html: "Feast of Ma<u>sh</u>íyyat"},
39
+ feast_12: {type: :feast, work_suspended: false, title: "Nineteen Day Feast of the month of Ilm (Knowledge)", short_title: "Feast of Ilm", title_html: "Nineteen Day Feast of the month of ‘Ilm (Knowledge)", short_title_html: "Feast of ‘Ilm"},
40
+ feast_13: {type: :feast, work_suspended: false, title: "Nineteen Day Feast of the month of Qudrat (Power)", short_title: "Feast of Qudrat", title_html: "Nineteen Day Feast of the month of Qudrat (Power)", short_title_html: "Feast of Qudrat"},
41
+ feast_14: {type: :feast, work_suspended: false, title: "Nineteen Day Feast of the month of Qawl (Speech)", short_title: "Feast of Qawl", title_html: "Nineteen Day Feast of the month of Qawl (Speech)", short_title_html: "Feast of Qawl"},
42
+ feast_15: {type: :feast, work_suspended: false, title: "Nineteen Day Feast of the month of Masail (Questions)", short_title: "Feast of Masail", title_html: "Nineteen Day Feast of the month of Masá’il (Questions)", short_title_html: "Feast of Masá’il"},
43
+ feast_16: {type: :feast, work_suspended: false, title: "Nineteen Day Feast of the month of Sharaf (Honour)", short_title: "Feast of Sharaf", title_html: "Nineteen Day Feast of the month of <u>Sh</u>araf (Honour)", short_title_html: "Feast of <u>Sh</u>araf"},
44
+ feast_17: {type: :feast, work_suspended: false, title: "Nineteen Day Feast of the month of Sultan (Sovereignty)", short_title: "Feast of Sultan", title_html: "Nineteen Day Feast of the month of Sulṭán (Sovereignty)", short_title_html: "Feast of Sulṭán"},
45
+ feast_18: {type: :feast, work_suspended: false, title: "Nineteen Day Feast of the month of Mulk (Dominion)", short_title: "Feast of Mulk", title_html: "Nineteen Day Feast of the month of Mulk (Dominion)", short_title_html: "Feast of Mulk"},
46
+ feast_19: {type: :feast, work_suspended: false, title: "Nineteen Day Feast of the month of Ala (Loftiness)", short_title: "Feast of Ala", title_html: "Nineteen Day Feast of the month of ‘Alá’ (Loftiness)", short_title_html: "Feast of ‘Alá’"},
47
+ ridvan_1: {type: :holy, work_suspended: true, title: "First day of the Festival of Ridvan", short_title: "1st day of Ridvan", title_html: "First day of the Festival of Riḍván", short_title_html: "1<sup>st</sup> day of Riḍván"},
48
+ ridvan_2: {type: :ridvan, work_suspended: false, title: "Second day of the Festival of Ridvan", short_title: "2nd day of Ridvan", title_html: "Second day of the Festival of Riḍván", short_title_html: "2<sup>nd</sup> day of Riḍván"},
49
+ ridvan_3: {type: :ridvan, work_suspended: false, title: "Third day of the Festival of Ridvan", short_title: "3rd day of Ridvan", title_html: "Third day of the Festival of Riḍván", short_title_html: "3<sup>rd</sup> day of Riḍván"},
50
+ ridvan_4: {type: :ridvan, work_suspended: false, title: "Fourth day of the Festival of Ridvan", short_title: "4th day of Ridvan", title_html: "Fourth day of the Festival of Riḍván", short_title_html: "4<sup>th</sup> day of Riḍván"},
51
+ ridvan_5: {type: :ridvan, work_suspended: false, title: "Fifth day of the Festival of Ridvan", short_title: "5th day of Ridvan", title_html: "Fifth day of the Festival of Riḍván", short_title_html: "5<sup>th</sup> day of Riḍván"},
52
+ ridvan_6: {type: :ridvan, work_suspended: false, title: "Sixth day of the Festival of Ridvan", short_title: "6th day of Ridvan", title_html: "Sixth day of the Festival of Riḍván", short_title_html: "6<sup>th</sup> day of Riḍván"},
53
+ ridvan_7: {type: :ridvan, work_suspended: false, title: "Seventh day of the Festival of Ridvan", short_title: "7th day of Ridvan", title_html: "Seventh day of the Festival of Riḍván", short_title_html: "7<sup>th</sup> day of Riḍván"},
54
+ ridvan_8: {type: :ridvan, work_suspended: false, title: "Eighth day of the Festival of Ridvan", short_title: "8th day of Ridvan", title_html: "Eighth day of the Festival of Riḍván", short_title_html: "8<sup>th</sup> day of Riḍván"},
55
+ ridvan_9: {type: :holy, work_suspended: true, title: "Ninth day of the Festival of Ridvan", short_title: "9th day of Ridvan", title_html: "Ninth day of the Festival of Riḍván", short_title_html: "9<sup>th</sup> day of Riḍván"},
56
+ ridvan_10: {type: :ridvan, work_suspended: false, title: "Tenth day of the Festival of Ridvan", short_title: "10th day of Ridvan", title_html: "Tenth day of the Festival of Riḍván", short_title_html: "10<sup>th</sup> day of Riḍván"},
57
+ ridvan_11: {type: :ridvan, work_suspended: false, title: "Eleventh day of the Festival of Ridvan", short_title: "11th day of Ridvan", title_html: "Eleventh day of the Festival of Riḍván", short_title_html: "11<sup>th</sup> day of Riḍván"},
58
+ ridvan_12: {type: :holy, work_suspended: true, title: "Twelfth day of the Festival of Ridvan", short_title: "12th day of Ridvan", title_html: "Twelfth day of the Festival of Riḍván", short_title_html: "12<sup>th</sup> day of Riḍván"},
59
+ nawruz: {type: :holy, work_suspended: true, title: "Naw-Ruz (New Year)", short_title: "Naw-Ruz", title_html: "Naw-Rúz (New Year)", short_title_html: "Naw-Rúz"},
60
+ declaration_bab: {type: :holy, work_suspended: true, title: "Declaration of the Bab", short_title: "Declaration of the Bab", title_html: "Declaration of the Báb", short_title_html: "Declaration of the Báb"},
61
+ ascension_bahaullah: {type: :holy, work_suspended: true, title: "Ascension of Baha'u'llah", short_title: "Ascension of Baha'u'llah", title_html: "Ascension of Bahá’u’lláh", short_title_html: "Ascension of Bahá’u’lláh"},
62
+ martyrdom_bab: {type: :holy, work_suspended: true, title: "Martyrdom of the Bab", short_title: "Martyrdom of the Bab", title_html: "Martyrdom of the Báb", short_title_html: "Martyrdom of the Báb"},
63
+ birth_bab: {type: :holy, work_suspended: true, title: "Anniversary of the Birth of the Bab", short_title: "Birth of the Bab", title_html: "Anniversary of the Birth of the Báb", short_title_html: "Birth of the Báb"},
64
+ birth_bahaullah: {type: :holy, work_suspended: true, title: "Anniversary of the Birth of Baha'u'llah", short_title: "Birth of Baha'u'llah", title_html: "Anniversary of the Birth of Bahá’u’lláh", short_title_html: "Birth of Bahá’u’lláh"},
65
+ covenant: {type: :holy, work_suspended: false, title: "Day of the Covenant", short_title: "Day of the Covenant", title_html: "Day of the Covenant", short_title_html: "Day of the Covenant"},
66
+ ascension_abdulbaha: {type: :holy, work_suspended: false, title: "Ascension of Abdu'l-Baha", short_title: "Ascension of Abdu'l-Baha", title_html: "Ascension of ‘Abdu’l-Bahá", short_title_html: "Ascension of ‘Abdu’l-Bahá"}
67
67
  }
68
68
 
69
69
  DATES = {
70
- '1.1' => [:nawruz, :feast_1],
71
- '2.1' => [:feast_2],
72
- '2.13' => [:ridvan_1],
73
- '2.14' => [:ridvan_2],
74
- '2.15' => [:ridvan_3],
75
- '2.16' => [:ridvan_4],
76
- '2.17' => [:ridvan_5],
77
- '2.18' => [:ridvan_6],
78
- '2.19' => [:ridvan_7],
79
- '3.1' => [:feast_3, :ridvan_8],
80
- '3.2' => [:ridvan_9],
81
- '3.3' => [:ridvan_10],
82
- '3.4' => [:ridvan_11],
83
- '3.5' => [:ridvan_12],
84
- '4.1' => [:feast_4],
85
- '4.13' => [:ascension_bahaullah],
86
- '5.1' => [:feast_5],
87
- '6.1' => [:feast_6],
88
- '7.1' => [:feast_7],
89
- '8.1' => [:feast_8],
90
- '9.1' => [:feast_9],
91
- '10.1' => [:feast_10],
92
- '11.1' => [:feast_11],
93
- '12.1' => [:feast_12],
94
- '13.1' => [:feast_13],
95
- '14.1' => [:feast_14],
96
- '14.4' => [:covenant],
97
- '14.6' => [:ascension_abdulbaha],
98
- '15.1' => [:feast_15],
99
- '16.1' => [:feast_16],
100
- '17.1' => [:feast_17],
101
- '18.1' => [:feast_18],
102
- '-1.1' => [:ayyam_i_ha_1],
103
- '-1.2' => [:ayyam_i_ha_2],
104
- '-1.3' => [:ayyam_i_ha_3],
105
- '-1.4' => [:ayyam_i_ha_4],
106
- '-1.5' => [:ayyam_i_ha_5],
107
- '19.1' => [:feast_19, :fasting_1],
108
- '19.2' => [:fasting_2],
109
- '19.3' => [:fasting_3],
110
- '19.4' => [:fasting_4],
111
- '19.5' => [:fasting_5],
112
- '19.6' => [:fasting_6],
113
- '19.7' => [:fasting_7],
114
- '19.8' => [:fasting_8],
115
- '19.9' => [:fasting_9],
116
- '19.10' => [:fasting_10],
117
- '19.11' => [:fasting_11],
118
- '19.12' => [:fasting_12],
119
- '19.13' => [:fasting_13],
120
- '19.14' => [:fasting_14],
121
- '19.15' => [:fasting_15],
122
- '19.16' => [:fasting_16],
123
- '19.17' => [:fasting_17],
124
- '19.18' => [:fasting_18],
125
- '19.19' => [:fasting_19]
70
+ "1.1" => [:nawruz, :feast_1],
71
+ "2.1" => [:feast_2],
72
+ "2.13" => [:ridvan_1],
73
+ "2.14" => [:ridvan_2],
74
+ "2.15" => [:ridvan_3],
75
+ "2.16" => [:ridvan_4],
76
+ "2.17" => [:ridvan_5],
77
+ "2.18" => [:ridvan_6],
78
+ "2.19" => [:ridvan_7],
79
+ "3.1" => [:feast_3, :ridvan_8],
80
+ "3.2" => [:ridvan_9],
81
+ "3.3" => [:ridvan_10],
82
+ "3.4" => [:ridvan_11],
83
+ "3.5" => [:ridvan_12],
84
+ "4.1" => [:feast_4],
85
+ "4.13" => [:ascension_bahaullah],
86
+ "5.1" => [:feast_5],
87
+ "6.1" => [:feast_6],
88
+ "7.1" => [:feast_7],
89
+ "8.1" => [:feast_8],
90
+ "9.1" => [:feast_9],
91
+ "10.1" => [:feast_10],
92
+ "11.1" => [:feast_11],
93
+ "12.1" => [:feast_12],
94
+ "13.1" => [:feast_13],
95
+ "14.1" => [:feast_14],
96
+ "14.4" => [:covenant],
97
+ "14.6" => [:ascension_abdulbaha],
98
+ "15.1" => [:feast_15],
99
+ "16.1" => [:feast_16],
100
+ "17.1" => [:feast_17],
101
+ "18.1" => [:feast_18],
102
+ "-1.1" => [:ayyam_i_ha_1],
103
+ "-1.2" => [:ayyam_i_ha_2],
104
+ "-1.3" => [:ayyam_i_ha_3],
105
+ "-1.4" => [:ayyam_i_ha_4],
106
+ "-1.5" => [:ayyam_i_ha_5],
107
+ "19.1" => [:feast_19, :fasting_1],
108
+ "19.2" => [:fasting_2],
109
+ "19.3" => [:fasting_3],
110
+ "19.4" => [:fasting_4],
111
+ "19.5" => [:fasting_5],
112
+ "19.6" => [:fasting_6],
113
+ "19.7" => [:fasting_7],
114
+ "19.8" => [:fasting_8],
115
+ "19.9" => [:fasting_9],
116
+ "19.10" => [:fasting_10],
117
+ "19.11" => [:fasting_11],
118
+ "19.12" => [:fasting_12],
119
+ "19.13" => [:fasting_13],
120
+ "19.14" => [:fasting_14],
121
+ "19.15" => [:fasting_15],
122
+ "19.16" => [:fasting_16],
123
+ "19.17" => [:fasting_17],
124
+ "19.18" => [:fasting_18],
125
+ "19.19" => [:fasting_19]
126
126
  }
127
127
 
128
128
  DATES_BEFORE_172 = {
129
- '4.7' => [:declaration_bab],
130
- '6.16' => [:martyrdom_bab],
131
- '12.5' => [:birth_bab],
132
- '13.9' => [:birth_bahaullah]
129
+ "4.7" => [:declaration_bab],
130
+ "6.16" => [:martyrdom_bab],
131
+ "12.5" => [:birth_bab],
132
+ "13.9" => [:birth_bahaullah]
133
133
  }
134
134
 
135
135
  DATES_AFTER_172 = {
136
- '4.8' => [:declaration_bab],
137
- '6.17' => [:martyrdom_bab]
136
+ "4.8" => [:declaration_bab],
137
+ "6.17" => [:martyrdom_bab]
138
138
  }
139
139
 
140
140
  def initialize(year, month, day)
@@ -147,13 +147,36 @@ module BahaiDate
147
147
  create_occasions_classes_from occasions_hashes
148
148
  end
149
149
 
150
+ def self.ayyam_i_ha_range(year)
151
+ first = BahaiDate.new(year:, month: -1, day: 1)
152
+ last = BahaiDate.new(year:, month: 19, day: 1)
153
+
154
+ first.gregorian_date..(last.gregorian_date.prev_day)
155
+ end
156
+
157
+ def self.fasting_range(year)
158
+ first = BahaiDate.new(year:, month: 19, day: 1)
159
+ last = BahaiDate.new(year:, month: 19, day: 19)
160
+
161
+ first.gregorian_date..(last.gregorian_date)
162
+ end
163
+
150
164
  def self.find(occasion, year)
151
- if year < 172
152
- all_dates = DATES.merge(DATES_BEFORE_172)
165
+ all_dates = if year < 172
166
+ DATES.merge(DATES_BEFORE_172)
153
167
  else
154
- all_dates = DATES.merge(DATES_AFTER_172).merge(dates_lunar(year))
168
+ DATES.merge(DATES_AFTER_172).merge(dates_lunar(year))
155
169
  end
156
- all_dates.find { |_key, array| array.include? occasion }.first
170
+ all_dates.find { |_key, array| array.include? occasion }&.first
171
+ end
172
+
173
+ def self.dates_lunar(year)
174
+ twin = Logic.twin_holy_days_date year
175
+ birth_bab = BahaiDate.new(date: twin)
176
+ birth_bab_string = "#{birth_bab.month.number}.#{birth_bab.day.number}"
177
+ birth_bahaullah = BahaiDate.new(date: twin + 1)
178
+ birth_bahaullah_string = "#{birth_bahaullah.month.number}.#{birth_bahaullah.day.number}"
179
+ {birth_bab_string => [:birth_bab], birth_bahaullah_string => [:birth_bahaullah]}
157
180
  end
158
181
 
159
182
  private
@@ -164,7 +187,7 @@ module BahaiDate
164
187
 
165
188
  def occasions_hashes
166
189
  hashes_array = []
167
- each_ids do | ids |
190
+ each_ids do |ids|
168
191
  next unless ids
169
192
  hashes_array += OCCASIONS.values_at(*ids)
170
193
  end
@@ -178,17 +201,8 @@ module BahaiDate
178
201
  yield DATES_BEFORE_172[key]
179
202
  else
180
203
  yield DATES_AFTER_172[key]
181
- yield (self.class.dates_lunar(@year))[key]
204
+ yield self.class.dates_lunar(@year)[key]
182
205
  end
183
206
  end
184
-
185
- def self.dates_lunar(year)
186
- twin = Logic.twin_holy_days_date year
187
- birth_bab = BahaiDate.new(date: twin)
188
- birth_bab_string = "#{birth_bab.month.number}.#{birth_bab.day.number}"
189
- birth_bahaullah = BahaiDate.new(date: twin + 1)
190
- birth_bahaullah_string = "#{birth_bahaullah.month.number}.#{birth_bahaullah.day.number}"
191
- { birth_bab_string => [:birth_bab], birth_bahaullah_string => [:birth_bahaullah] }
192
- end
193
207
  end
194
208
  end
@@ -0,0 +1,65 @@
1
+ require "date"
2
+
3
+ module BahaiDate
4
+ # Time of sunset, from the sunrise/sunset algorithm in the _Almanac for
5
+ # Computers_ (Nautical Almanac Office, United States Naval Observatory, 1990),
6
+ # as published by the Naval Observatory and implemented in the RubySunrise gem
7
+ # (MIT licence), which this gem used until 2.0.0.
8
+ #
9
+ # It is a short approximation: the Sun's position comes from the day of the
10
+ # year and constants for the present era, with no terms for the year itself,
11
+ # so it slowly loses accuracy as the Earth's orbit changes over the
12
+ # centuries. See Logic::MAX_GREGORIAN_YEAR for how much that matters.
13
+ module Sunset
14
+ # The Sun's centre 90 degrees 50 minutes from the zenith: the Sun's
15
+ # semi-diameter plus standard atmospheric refraction at the horizon.
16
+ OFFICIAL_ZENITH = 90.833333
17
+
18
+ # The moment of sunset on the given date at the given place, as a UTC Time
19
+ # truncated to the minute, or nil if the Sun does not set that day (polar
20
+ # summer or winter). The truncation is RubySunrise's: keeping it means the
21
+ # gem gives the same dates it always has (keeping the seconds moves
22
+ # Naw-Ruz in 2418 by a day, where the equinox is within a minute of sunset).
23
+ def self.utc(date, latitude, longitude, zenith = OFFICIAL_ZENITH)
24
+ longitude_hour = longitude / 15.0
25
+ t = date.yday + (18.0 - longitude_hour) / 24.0
26
+
27
+ mean_anomaly = 0.9856 * t - 3.289
28
+ true_longitude = normalize(
29
+ mean_anomaly + 1.916 * sin(mean_anomaly) + 0.020 * sin(2 * mean_anomaly) + 282.634, 360.0
30
+ )
31
+
32
+ # Right ascension, in the same quadrant as the true longitude, in hours.
33
+ right_ascension = normalize(degrees(Math.atan(0.91764 * tan(true_longitude))), 360.0)
34
+ right_ascension += (true_longitude / 90.0).floor * 90.0 - (right_ascension / 90.0).floor * 90.0
35
+ right_ascension /= 15.0
36
+
37
+ sin_declination = 0.39782 * sin(true_longitude)
38
+ cos_declination = Math.cos(Math.asin(sin_declination))
39
+ cos_hour_angle = (cos(zenith) - sin_declination * sin(latitude)) / (cos_declination * cos(latitude))
40
+ return nil unless (-1.0..1.0).cover?(cos_hour_angle)
41
+
42
+ hour_angle = degrees(Math.acos(cos_hour_angle)) / 15.0
43
+ local_mean_time = hour_angle + right_ascension - 0.06571 * t - 6.622
44
+ hours = normalize(local_mean_time - longitude_hour, 24.0)
45
+
46
+ Time.utc(date.year, date.month, date.day) + (hours * 60).floor * 60
47
+ end
48
+
49
+ def self.normalize(value, range)
50
+ value % range
51
+ end
52
+
53
+ def self.sin(degrees) = Math.sin(radians(degrees))
54
+
55
+ def self.cos(degrees) = Math.cos(radians(degrees))
56
+
57
+ def self.tan(degrees) = Math.tan(radians(degrees))
58
+
59
+ def self.radians(degrees) = degrees * Math::PI / 180.0
60
+
61
+ def self.degrees(radians) = radians * 180.0 / Math::PI
62
+
63
+ private_class_method :normalize, :sin, :cos, :tan, :radians, :degrees
64
+ end
65
+ end
@@ -1,3 +1,3 @@
1
1
  module BahaiDate
2
- VERSION = '1.4.0'
2
+ VERSION = "2.0.0"
3
3
  end
@@ -1,9 +1,9 @@
1
1
  module BahaiDate
2
2
  class Weekday
3
- TITLES = %w(Jalal Jamal Kamal Fidal Idal Istijlal Istiqlal)
4
- TITLES_HTML = %w(Jalál Jamál Kamál Fiḍál ‘Idál Istijlál Istiqlál)
5
- TITLES_EN = %w(Glory Beauty Perfection Grace Justice Majesty Independence)
6
- ENGLISH_EQUIVALENTS = %w(Saturday Sunday Monday Tuesday Wednesday Thursday Friday)
3
+ TITLES = %w[Jalal Jamal Kamal Fidal Idal Istijlal Istiqlal]
4
+ TITLES_HTML = %w[Jalál Jamál Kamál Fiḍál ‘Idál Istijlál Istiqlál]
5
+ TITLES_EN = %w[Glory Beauty Perfection Grace Justice Majesty Independence]
6
+ ENGLISH_EQUIVALENTS = %w[Saturday Sunday Monday Tuesday Wednesday Thursday Friday]
7
7
 
8
8
  attr_reader :number
9
9
 
@@ -40,7 +40,7 @@ module BahaiDate
40
40
 
41
41
  def validate(number_arg)
42
42
  number = number_arg.to_i
43
- return if (1..7).include? number
43
+ return if (1..7).cover? number
44
44
 
45
45
  fail ArgumentError, "'#{number}' is not a valid weekday. Please use 1 to 7."
46
46
  end
@@ -1,13 +1,23 @@
1
1
  module BahaiDate
2
2
  class Year
3
- TITLES = %w(Alif Ba Ab Dal Bab Vav Abad Jad Baha Hubb Bahhaj Javab Ahad Vahhab Vidad Badi Bahi Abha Vahid)
4
- 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)
5
- TITLES_EN = %w(A B Father D Gate V Eternity Generosity Splendour Love Delightful Answer Single Bountiful Affection Beginning Luminous Most Luminous Unity)
3
+ TITLES = %w[Alif Ba Ab Dal Bab Vav Abad Jad Baha Hubb Bahhaj Javab Ahad Vahhab Vidad Badi Bahi Abha Vahid]
4
+ 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]
5
+ TITLES_EN = ["A", "B", "Father", "D", "Gate", "V", "Eternity", "Generosity", "Splendour", "Love", "Delightful", "Answer", "Single", "Bountiful", "Affection", "Beginning", "Luminous", "Most Luminous", "Unity"]
6
+
7
+ # The last year this gem supports: see Logic::MAX_GREGORIAN_YEAR.
8
+ MAX = 1157
6
9
 
7
10
  attr_reader :bahai_era, :number, :vahid, :kull_i_shay, :months
8
11
 
12
+ def self.check(number_arg)
13
+ number = number_arg.to_i
14
+ return number if (1..MAX).cover?(number)
15
+
16
+ fail ArgumentError, "'#{number_arg}' is not a valid year. Please use a number from 1 to #{MAX}."
17
+ end
18
+
9
19
  def initialize(number_arg)
10
- validate number_arg
20
+ self.class.check number_arg
11
21
  @bahai_era = number_arg.to_i
12
22
  calculate_number_vahid_and_kull_i_shay
13
23
  @months = {}
@@ -43,13 +53,6 @@ module BahaiDate
43
53
  @number - 1
44
54
  end
45
55
 
46
- def validate(number_arg)
47
- number = number_arg.to_i
48
- return unless number < 1
49
-
50
- fail ArgumentError, "'#{number}' is not a valid year. Please use a number greater than or equal to 1."
51
- end
52
-
53
56
  def calculate_number_vahid_and_kull_i_shay
54
57
  @vahid, @number = (@bahai_era - 1).divmod(19)
55
58
  @kull_i_shay, @vahid = @vahid.divmod(19)
data/lib/bahai_date.rb CHANGED
@@ -1,11 +1,11 @@
1
- require 'date'
2
- require 'bahai_date/version'
3
- require 'bahai_date/logic'
4
- require 'bahai_date/bahai_date'
5
- require 'bahai_date/year'
6
- require 'bahai_date/month'
7
- require 'bahai_date/day'
8
- require 'bahai_date/weekday'
9
- require 'bahai_date/occasion'
10
- require 'bahai_date/occasion_factory'
11
- require 'bahai_date/year_calendar'
1
+ require "date"
2
+ require "bahai_date/version"
3
+ require "bahai_date/logic"
4
+ require "bahai_date/bahai_date"
5
+ require "bahai_date/year"
6
+ require "bahai_date/month"
7
+ require "bahai_date/day"
8
+ require "bahai_date/weekday"
9
+ require "bahai_date/occasion"
10
+ require "bahai_date/occasion_factory"
11
+ require "bahai_date/year_calendar"