bahai_date 1.0.0 → 1.1.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.
- checksums.yaml +4 -4
- data/README.md +2 -34
- data/lib/bahai_date.rb +11 -0
- data/lib/bahai_date/bahai_date.rb +9 -29
- data/lib/bahai_date/day.rb +10 -21
- data/lib/bahai_date/month.rb +12 -17
- data/lib/bahai_date/occasion.rb +1 -5
- data/lib/bahai_date/occasion_factory.rb +68 -75
- data/lib/bahai_date/version.rb +3 -0
- data/lib/bahai_date/weekday.rb +9 -12
- data/lib/bahai_date/year.rb +10 -15
- data/lib/bahai_date/year_calendar.rb +7 -14
- data/lib/bahai_date/year_data.rb +2 -8
- data/spec/bahai_date/bahai_date_spec.rb +115 -111
- data/spec/bahai_date/day_spec.rb +16 -23
- data/spec/bahai_date/month_spec.rb +17 -21
- data/spec/bahai_date/occasion_factory_spec.rb +21 -25
- data/spec/bahai_date/occasion_spec.rb +12 -18
- data/spec/bahai_date/weekday_spec.rb +10 -14
- data/spec/bahai_date/year_calendar_spec.rb +6 -10
- data/spec/bahai_date/year_data_spec.rb +6 -10
- data/spec/bahai_date/year_spec.rb +22 -26
- data/spec/spec_helper.rb +1 -0
- metadata +16 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f699ecd3de3f25939880c531d0cdedcca848bd71
|
4
|
+
data.tar.gz: 01844381135ab67aad7d90b3c28550359f96dd94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57a922accd8e81aca4538a59ecc35c39c1e02c3b6492ff39598292d4c4a007a6cd72d18eccee77bf8cbb221b576efdebcec785d4c3b95a108f94cf9ba38fd21e
|
7
|
+
data.tar.gz: adc46853c9f7f8eadfdabc491ae4220bd19c2a661e6b45e1cc6727326bb2bd9db43204e30725ac5bf5a20b7d4f326b2eab4949a9bb66931287a60acf9783765c
|
data/README.md
CHANGED
@@ -2,6 +2,8 @@ Baha'i Date Ruby Gem
|
|
2
2
|
====================
|
3
3
|
A Ruby gem for conversion between the Gregorian calendar and the Baha'i (or Badi) calendar.
|
4
4
|
|
5
|
+
[](http://badge.fury.io/rb/bahai_date)
|
6
|
+
|
5
7
|
|
6
8
|
The Baha'i calendar
|
7
9
|
-------------------
|
@@ -18,40 +20,6 @@ Functionality
|
|
18
20
|
-------------
|
19
21
|
A BahaiDate instance can be created either from a Gregorian date or supplying the year, month and day in the Baha'i calendar.
|
20
22
|
|
21
|
-
The instance then exposes:
|
22
|
-
- **weekday**
|
23
|
-
- **number**: e.g. 6
|
24
|
-
- **title**: e.g. Istijlal
|
25
|
-
- **translation**: e.g. Majesty
|
26
|
-
- **html**: e.g. Istijlál
|
27
|
-
- **english_equivalent**: e.g. Thursday
|
28
|
-
- **day**
|
29
|
-
- **number**: e.g. 1
|
30
|
-
- **title**: e.g. Baha
|
31
|
-
- **translation**: e.g. Splendour
|
32
|
-
- **html**: e.g. Bahá
|
33
|
-
- **month**
|
34
|
-
- **number**: e.g. 1
|
35
|
-
- **title**: e.g. Baha
|
36
|
-
- **translation**: e.g. Splendour
|
37
|
-
- **html**: e.g. Bahá
|
38
|
-
- **year**
|
39
|
-
- **bahai_era**: e.g. 172
|
40
|
-
- **number**: e.g. 1
|
41
|
-
- **title**: e.g. Alif
|
42
|
-
- **translation**: e.g. A
|
43
|
-
- **html**: e.g. Alif
|
44
|
-
- **vahid**: e.g. 10
|
45
|
-
- **kull_i_shay**: e.g. 1
|
46
|
-
- **gregorian_date**: e.g. 2015-3-21 (using the ruby Date class)
|
47
|
-
- **occasions**: array of Occasion objects:
|
48
|
-
- **type**: e.g. holy
|
49
|
-
- **work_suspended?**: e.g. true
|
50
|
-
- **title**: e.g. Naw-Ruz (New Year)
|
51
|
-
- **short_title**: e.g. Naw-Ruz
|
52
|
-
- **title_html**: e.g. Naw-Rúz (New Year)
|
53
|
-
- **short_title_html**: e.g. Naw-Rúz
|
54
|
-
|
55
23
|
A calendar can also be obtained using the YearCalendar class and providing a year. It is then populated with details about that year, each month and each day in it.
|
56
24
|
|
57
25
|
|
data/lib/bahai_date.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require "date"
|
2
|
+
require "bahai_date/version"
|
3
|
+
require "bahai_date/bahai_date"
|
4
|
+
require "bahai_date/year"
|
5
|
+
require "bahai_date/month"
|
6
|
+
require "bahai_date/day"
|
7
|
+
require "bahai_date/weekday"
|
8
|
+
require "bahai_date/year_data"
|
9
|
+
require "bahai_date/occasion"
|
10
|
+
require "bahai_date/occasion_factory"
|
11
|
+
require "bahai_date/year_calendar"
|
@@ -1,13 +1,4 @@
|
|
1
|
-
require 'date'
|
2
|
-
require_relative 'year'
|
3
|
-
require_relative 'month'
|
4
|
-
require_relative 'day'
|
5
|
-
require_relative 'weekday'
|
6
|
-
require_relative 'year_data'
|
7
|
-
require_relative 'occasion_factory'
|
8
|
-
|
9
1
|
module BahaiDate
|
10
|
-
|
11
2
|
class BahaiDate
|
12
3
|
|
13
4
|
AYYAM_I_HA = -1
|
@@ -21,14 +12,14 @@ module BahaiDate
|
|
21
12
|
@year = Year.new(year)
|
22
13
|
@month = Month.new(month)
|
23
14
|
@day = Day.new(day)
|
24
|
-
elsif params[:year]
|
15
|
+
elsif params[:year] && params[:month] && params[:day]
|
25
16
|
@year = Year.new(params[:year])
|
26
17
|
@month = Month.new(params[:month])
|
27
18
|
@day = Day.new(params[:day])
|
28
19
|
validate_ayyam_i_ha
|
29
20
|
@gregorian_date = to_gregorian
|
30
21
|
else
|
31
|
-
|
22
|
+
fail ArgumentError, 'Invalid arguments. Use a hash with :date or with :year, :month, and :day.'
|
32
23
|
end
|
33
24
|
@weekday = Weekday.new(weekday_from_gregorian)
|
34
25
|
@occasions = OccasionFactory.new(@year.bahai_era, @month.number, @day.number).occasions
|
@@ -46,16 +37,14 @@ module BahaiDate
|
|
46
37
|
initialize(date: @gregorian_date + 1)
|
47
38
|
end
|
48
39
|
|
49
|
-
|
40
|
+
private
|
50
41
|
|
51
42
|
def validate_ayyam_i_ha
|
52
|
-
if @month.number == AYYAM_I_HA && @day.number > ayyam_i_ha_days
|
53
|
-
raise ArgumentError, "'#{@day.number}' is not a valid day for Ayyam-i-Ha in the year #{@year.bahai_era}"
|
54
|
-
end
|
43
|
+
fail ArgumentError, "'#{@day.number}' is not a valid day for Ayyam-i-Ha in the year #{@year.bahai_era}" if @month.number == AYYAM_I_HA && @day.number > ayyam_i_ha_days
|
55
44
|
end
|
56
45
|
|
57
46
|
def ayyam_i_ha_days(year = @year.bahai_era)
|
58
|
-
|
47
|
+
YearData.leap?(year) ? 5 : 4
|
59
48
|
end
|
60
49
|
|
61
50
|
def to_gregorian
|
@@ -68,13 +57,13 @@ module BahaiDate
|
|
68
57
|
nawruz = YearData.nawruz_for(@gregorian_date.year)
|
69
58
|
|
70
59
|
year = @gregorian_date.year - 1844
|
71
|
-
if @gregorian_date >= nawruz
|
60
|
+
if @gregorian_date >= nawruz
|
72
61
|
year += 1
|
73
62
|
days = (@gregorian_date - nawruz).to_i
|
74
63
|
else
|
75
64
|
days = (@gregorian_date - YearData.nawruz_for(@gregorian_date.year - 1)).to_i
|
76
65
|
end
|
77
|
-
|
66
|
+
|
78
67
|
# determine day and month, taking into account ayyam-i-ha
|
79
68
|
if days >= 342
|
80
69
|
if days < (342 + ayyam_i_ha_days(year))
|
@@ -99,20 +88,11 @@ module BahaiDate
|
|
99
88
|
|
100
89
|
def days_from_nawruz
|
101
90
|
days = @day.number - 1
|
102
|
-
|
103
91
|
full_months = @month.number - 1
|
104
|
-
if @month.number == AYYAM_I_HA
|
105
|
-
full_months = 18
|
106
|
-
end
|
92
|
+
full_months = 18 if @month.number == AYYAM_I_HA
|
107
93
|
days += full_months * 19
|
108
|
-
|
109
|
-
if @month.number == 19
|
110
|
-
days += ayyam_i_ha_days
|
111
|
-
end
|
112
|
-
|
94
|
+
days += ayyam_i_ha_days if @month.number == 19
|
113
95
|
days
|
114
96
|
end
|
115
|
-
|
116
97
|
end
|
117
|
-
|
118
98
|
end
|
data/lib/bahai_date/day.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
module BahaiDate
|
2
|
+
class Day
|
3
|
+
TITLES = %w(Baha Jalal Jamal Azamat Nur Rahmat Kalimat Kamal Asma Izzat Mashiyyat Ilm Qudrat Qawl Masail Sharaf Sultan Mulk Ala)
|
4
|
+
TITLES_HTML = %w(Bahá Jalál Jamál ‘Aẓamat Núr Raḥmat Kalimát Kamál Asmá’ ‘Izzat Ma<u>sh</u>íyyat ‘Ilm Qudrat Qawl Masá’il <u>Sh</u>araf Sulṭán Mulk ‘Alá’)
|
5
|
+
TITLES_EN = %w(Splendour Glory Beauty Grandeur Light Mercy Words Perfection Names Might Will Knowledge Power Speech Questions Honour Sovereignty Dominion Loftiness)
|
2
6
|
|
3
|
-
|
4
|
-
|
5
|
-
TITLES_HTML = %w[Bahá Jalál Jamál ‘Aẓamat Núr Raḥmat Kalimát Kamál Asmá’ ‘Izzat Ma<u>sh</u>íyyat ‘Ilm Qudrat Qawl Masá’il <u>Sh</u>araf Sulṭán Mulk ‘Alá’]
|
6
|
-
TITLES_EN = %w[Splendour Glory Beauty Grandeur Light Mercy Words Perfection Names Might Will Knowledge Power Speech Questions Honour Sovereignty Dominion Loftiness]
|
7
|
-
|
8
|
-
attr_reader :number, :weekday, :occasions
|
7
|
+
attr_reader :number
|
8
|
+
attr_accessor :occasions, :weekday
|
9
9
|
|
10
10
|
def initialize(number_arg)
|
11
11
|
validate number_arg
|
@@ -28,15 +28,7 @@ module BahaiDate
|
|
28
28
|
TITLES_HTML[title_index]
|
29
29
|
end
|
30
30
|
|
31
|
-
|
32
|
-
@weekday = weekday
|
33
|
-
end
|
34
|
-
|
35
|
-
def set_occasions(occasions)
|
36
|
-
@occasions = occasions
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
31
|
+
private
|
40
32
|
|
41
33
|
def title_index
|
42
34
|
@number - 1
|
@@ -44,11 +36,8 @@ module BahaiDate
|
|
44
36
|
|
45
37
|
def validate(number_arg)
|
46
38
|
number = number_arg.to_i
|
47
|
-
if (
|
48
|
-
|
49
|
-
|
50
|
-
end
|
51
|
-
|
39
|
+
return if (1..19).include? number
|
40
|
+
fail ArgumentError, "'#{number}' is not a valid day. Please use 1 to 19."
|
41
|
+
end
|
52
42
|
end
|
53
|
-
|
54
43
|
end
|
data/lib/bahai_date/month.rb
CHANGED
@@ -1,9 +1,8 @@
|
|
1
1
|
module BahaiDate
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
TITLES_EN = %w[Splendour Glory Beauty Grandeur Light Mercy Words Perfection Names Might Will Knowledge Power Speech Questions Honour Sovereignty Dominion Loftiness Ayyam-i-Ha]
|
2
|
+
class Month
|
3
|
+
TITLES = %w(Baha Jalal Jamal Azamat Nur Rahmat Kalimat Kamal Asma Izzat Mashiyyat Ilm Qudrat Qawl Masail Sharaf Sultan Mulk Ala Ayyam-i-Ha)
|
4
|
+
TITLES_HTML = %w(Bahá Jalál Jamál ‘Aẓamat Núr Raḥmat Kalimát Kamál Asmá’ ‘Izzat Ma<u>sh</u>íyyat ‘Ilm Qudrat Qawl Masá’il <u>Sh</u>araf Sulṭán Mulk ‘Alá’ Ayyám-i-Há)
|
5
|
+
TITLES_EN = %w(Splendour Glory Beauty Grandeur Light Mercy Words Perfection Names Might Will Knowledge Power Speech Questions Honour Sovereignty Dominion Loftiness Ayyam-i-Ha)
|
7
6
|
|
8
7
|
attr_reader :number, :days
|
9
8
|
|
@@ -29,17 +28,16 @@ module BahaiDate
|
|
29
28
|
TITLES_HTML[title_index]
|
30
29
|
end
|
31
30
|
|
32
|
-
def
|
33
|
-
|
34
|
-
|
35
|
-
end
|
31
|
+
def add_day(day_number)
|
32
|
+
return if @days[day_number]
|
33
|
+
@days[day_number] = Day.new(day_number)
|
36
34
|
end
|
37
35
|
|
38
|
-
|
36
|
+
private
|
39
37
|
|
40
38
|
def title_index
|
41
39
|
if @number == -1
|
42
|
-
19 #20th element of the array
|
40
|
+
19 # 20th element of the array
|
43
41
|
else
|
44
42
|
@number - 1
|
45
43
|
end
|
@@ -47,11 +45,8 @@ module BahaiDate
|
|
47
45
|
|
48
46
|
def validate(number_arg)
|
49
47
|
number = number_arg.to_i
|
50
|
-
if (number
|
51
|
-
|
52
|
-
|
53
|
-
end
|
54
|
-
|
48
|
+
return if ((1..19).include?(number) || number == -1)
|
49
|
+
fail ArgumentError, "'#{number}' is not a valid month. Please use 1 to 19 or -1 for Ayyam-i-Ha."
|
50
|
+
end
|
55
51
|
end
|
56
|
-
|
57
52
|
end
|
data/lib/bahai_date/occasion.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
module BahaiDate
|
2
|
-
|
3
2
|
class Occasion
|
4
|
-
|
5
|
-
attr_reader :type,
|
3
|
+
attr_reader :type,
|
6
4
|
:work_suspended,
|
7
5
|
:title,
|
8
6
|
:short_title,
|
@@ -18,7 +16,5 @@ module BahaiDate
|
|
18
16
|
@title_html = opts[:title_html]
|
19
17
|
@short_title_html = opts[:short_title_html]
|
20
18
|
end
|
21
|
-
|
22
19
|
end
|
23
|
-
|
24
20
|
end
|
@@ -1,73 +1,69 @@
|
|
1
|
-
require_relative 'occasion'
|
2
|
-
|
3
1
|
module BahaiDate
|
4
|
-
|
5
2
|
class OccasionFactory
|
6
|
-
|
7
3
|
OCCASIONS = {
|
8
|
-
:
|
9
|
-
:
|
10
|
-
:
|
11
|
-
:
|
12
|
-
:
|
13
|
-
:
|
14
|
-
:
|
15
|
-
:
|
16
|
-
:
|
17
|
-
:
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
21
|
-
:
|
22
|
-
:
|
23
|
-
:
|
24
|
-
:
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:
|
36
|
-
:
|
37
|
-
:
|
38
|
-
:
|
39
|
-
:
|
40
|
-
:
|
41
|
-
:
|
42
|
-
:
|
43
|
-
:
|
44
|
-
:
|
45
|
-
:
|
46
|
-
:
|
47
|
-
:
|
48
|
-
:
|
49
|
-
:
|
50
|
-
:
|
51
|
-
:
|
52
|
-
:
|
53
|
-
:
|
54
|
-
:
|
55
|
-
:
|
56
|
-
:
|
57
|
-
:
|
58
|
-
:
|
59
|
-
:
|
60
|
-
:
|
61
|
-
:
|
62
|
-
:
|
63
|
-
:
|
64
|
-
:
|
65
|
-
:
|
66
|
-
:
|
67
|
-
:
|
68
|
-
:
|
69
|
-
:
|
70
|
-
:
|
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á' }
|
71
67
|
}
|
72
68
|
|
73
69
|
DATES = {
|
@@ -289,7 +285,7 @@ module BahaiDate
|
|
289
285
|
create_occasions_classes_from occasions_hashes
|
290
286
|
end
|
291
287
|
|
292
|
-
|
288
|
+
private
|
293
289
|
|
294
290
|
def create_occasions_classes_from(hashes_array)
|
295
291
|
hashes_array.map! { |opts_hash| Occasion.new(opts_hash) }
|
@@ -297,11 +293,10 @@ module BahaiDate
|
|
297
293
|
|
298
294
|
def occasions_hashes
|
299
295
|
hashes_array = []
|
300
|
-
each_ids
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
}
|
296
|
+
each_ids do | ids |
|
297
|
+
next unless ids
|
298
|
+
hashes_array += OCCASIONS.values_at(*ids)
|
299
|
+
end
|
305
300
|
hashes_array
|
306
301
|
end
|
307
302
|
|
@@ -315,7 +310,5 @@ module BahaiDate
|
|
315
310
|
yield DATES_LUNAR[@year][key]
|
316
311
|
end
|
317
312
|
end
|
318
|
-
|
319
313
|
end
|
320
|
-
|
321
314
|
end
|