hebrew_date 1.0.10 → 1.0.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/hebrew_date.gemspec +2 -2
- data/lib/hebrew_date.rb +23 -9
- data/lib/support/holidays.rb +34 -34
- data/lib/support/parshiot.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35508f471f98b8c7ef8bee61a474a8ef07b4f7b3
|
4
|
+
data.tar.gz: 7325bcdbed021dbfdd5e9b2433f95d3206fc118b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9a26c8a810b30e48831a05870bfb7bac0b709bb6cb31daeb45fa824b2302371aa72f82195ce2ca33138fa60318ae97af11d5f54e3e4958d769907acc3b1ba35
|
7
|
+
data.tar.gz: 402fa96a1c29c90ef7c85f978a7111ae0e9ccc60c3b86964af4aa6a2d1f2660f3e398fc524784c1cebef797e3026ff61249dfcd020b71227ad1ab124e4eed68e
|
data/hebrew_date.gemspec
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'hebrew_date'
|
3
3
|
s.require_paths = %w(. lib)
|
4
|
-
s.version = '1.0.
|
5
|
-
s.date = '2014-
|
4
|
+
s.version = '1.0.11'
|
5
|
+
s.date = '2014-02-03'
|
6
6
|
s.summary = 'Hebrew/Jewish dates, times, and holidays.'
|
7
7
|
s.description = <<-EOF
|
8
8
|
hebrew_date is a library designed to provide information about the Jewish
|
data/lib/hebrew_date.rb
CHANGED
@@ -86,7 +86,7 @@ class HebrewDate < Delegator
|
|
86
86
|
strftime('*Y-*-m-*-d (%Y-%-m-%-d)')
|
87
87
|
end
|
88
88
|
|
89
|
-
[
|
89
|
+
[:<<, :>>, :gregorian, :england, :italy, :julian, :new_start,
|
90
90
|
:next_month, :next_year, :prev_day, :prev_month,
|
91
91
|
:prev_year].each do |method_name|
|
92
92
|
define_method(method_name) do |*args|
|
@@ -104,10 +104,24 @@ class HebrewDate < Delegator
|
|
104
104
|
# do nothing
|
105
105
|
end
|
106
106
|
|
107
|
-
#
|
107
|
+
# @param other [Fixnum]
|
108
108
|
# @return [HebrewDate]
|
109
|
-
def
|
110
|
-
self.
|
109
|
+
def +(other)
|
110
|
+
date = self.clone
|
111
|
+
(1..other).each do |i|
|
112
|
+
date.forward
|
113
|
+
end
|
114
|
+
date
|
115
|
+
end
|
116
|
+
|
117
|
+
# @param other [Fixnum]
|
118
|
+
# @return [HebrewDate]
|
119
|
+
def -(other)
|
120
|
+
date = self.clone
|
121
|
+
(1..other).each do |i|
|
122
|
+
date.back
|
123
|
+
end
|
124
|
+
date
|
111
125
|
end
|
112
126
|
|
113
127
|
# Comparison operator.
|
@@ -312,7 +326,7 @@ class HebrewDate < Delegator
|
|
312
326
|
# @param year [Integer]
|
313
327
|
# @return [String]
|
314
328
|
def self.hebrew_month_to_s(month, year=nil)
|
315
|
-
year ||=
|
329
|
+
year ||= self.class.new.hebrew_year
|
316
330
|
if hebrew_leap_year?(year) && month == 12
|
317
331
|
'Adar I'
|
318
332
|
else
|
@@ -362,8 +376,8 @@ class HebrewDate < Delegator
|
|
362
376
|
.gsub('*d', @hebrew_date.to_s.rjust(2, '0'))
|
363
377
|
.gsub('*-d', @hebrew_date.to_s)
|
364
378
|
.gsub('*e', @hebrew_date.to_s.rjust(2, ' '))
|
365
|
-
if
|
366
|
-
shab_name =
|
379
|
+
if self.class.replace_saturday && @hebrew_date.day == 7
|
380
|
+
shab_name = self.class.ashkenaz ? 'Shabbos' : 'Shabbat'
|
367
381
|
format = format.gsub('%A', shab_name)
|
368
382
|
.gsub('%^A', shab_name.upcase)
|
369
383
|
.gsub('%a', shab_name[0..2])
|
@@ -502,10 +516,10 @@ class HebrewDate < Delegator
|
|
502
516
|
if (conjunction_parts >= 19440) || # If new moon is at or after midday,
|
503
517
|
(((conjunction_day.remainder(7)) == 2) && # ...or is on a Tuesday...
|
504
518
|
(conjunction_parts >= 9924) && # at 9 hours, 204 parts or later...
|
505
|
-
!
|
519
|
+
!self.class.hebrew_leap_year?(year)) || # ...of a common year,
|
506
520
|
(((conjunction_day.remainder(7)) == 1) && # ...or is on a Monday at...
|
507
521
|
(conjunction_parts >= 16789) && # 15 hours, 589 parts or later...
|
508
|
-
(
|
522
|
+
(self.class.hebrew_leap_year?(year - 1))) # at the end of a leap year
|
509
523
|
# Then postpone Rosh HaShanah one day
|
510
524
|
alternative_day += 1
|
511
525
|
end
|
data/lib/support/holidays.rb
CHANGED
@@ -41,20 +41,20 @@ module HebrewDateSupport
|
|
41
41
|
# @param year [Integer] if given, the Hebrew year to search. Defaults
|
42
42
|
# to the current year.
|
43
43
|
def from_holiday(holiday, year=nil)
|
44
|
-
year ||=
|
44
|
+
year ||= self.new.hebrew_year
|
45
45
|
case holiday
|
46
46
|
when :EREV_PESACH
|
47
|
-
|
47
|
+
self.new_from_hebrew(year, 1, 14)
|
48
48
|
when :PESACH
|
49
|
-
|
49
|
+
self.new_from_hebrew(year, 1, 15)
|
50
50
|
when :PESACH_2
|
51
|
-
|
51
|
+
self.new_from_hebrew(year, 1, 21)
|
52
52
|
when :PESACH_SHENI
|
53
|
-
|
53
|
+
self.new_from_hebrew(year, 2, 15)
|
54
54
|
when :YOM_HAZIKARON
|
55
|
-
|
55
|
+
self.from_holiday(:YOM_HAATZMAUT).back
|
56
56
|
when :YOM_HAATZMAUT
|
57
|
-
date =
|
57
|
+
date = self.new_from_hebrew(year, 2, 5)
|
58
58
|
# Friday or Shabbat - move back to Thursday
|
59
59
|
# Monday - move forward to Tuesday
|
60
60
|
if date.day == 6
|
@@ -65,56 +65,56 @@ module HebrewDateSupport
|
|
65
65
|
date.set_hebrew_date(year, 2, 3)
|
66
66
|
end
|
67
67
|
when :LAG_BAOMER
|
68
|
-
|
68
|
+
self.new_from_hebrew(year, 2, 18)
|
69
69
|
when :YOM_YERUSHALAYIM
|
70
|
-
|
70
|
+
self.new_from_hebrew(year, 2, 28)
|
71
71
|
when :TZOM_TAMMUZ
|
72
|
-
date =
|
72
|
+
date = self.new_from_hebrew(year, 4, 17)
|
73
73
|
date.forward if date.day == 7
|
74
74
|
date
|
75
75
|
when :EREV_SHAVUOT
|
76
|
-
|
76
|
+
self.new_from_hebrew(year, 3, 5)
|
77
77
|
when :SHAVUOT
|
78
|
-
|
78
|
+
self.new_from_hebrew(year, 3, 6)
|
79
79
|
when :TISHA_BAV
|
80
|
-
date =
|
80
|
+
date = self.new_from_hebrew(year, 5, 9)
|
81
81
|
date.forward if date.day == 7
|
82
82
|
date
|
83
83
|
when :TU_BAV
|
84
|
-
|
84
|
+
self.new_from_hebrew(year, 15, 9)
|
85
85
|
when :EREV_ROSH_HASHANA
|
86
|
-
|
86
|
+
self.new_from_hebrew(year, 6, 29)
|
87
87
|
when :ROSH_HASHANA
|
88
|
-
|
88
|
+
self.new_from_hebrew(year, 7, 1)
|
89
89
|
when :TZOM_GEDALIA
|
90
|
-
date =
|
90
|
+
date = self.new_from_hebrew(year, 7, 3)
|
91
91
|
date.forward if date.day == 7
|
92
92
|
date
|
93
93
|
when :EREV_YOM_KIPPUR
|
94
|
-
|
94
|
+
self.new_from_hebrew(year, 7, 9)
|
95
95
|
when :YOM_KIPPUR
|
96
|
-
|
96
|
+
self.new_from_hebrew(year, 7, 10)
|
97
97
|
when :EREV_SUKKOT
|
98
|
-
|
98
|
+
self.new_from_hebrew(year, 7, 14)
|
99
99
|
when :SUKKOT
|
100
|
-
|
100
|
+
self.new_from_hebrew(year, 7, 15)
|
101
101
|
when :SHMINI_ATZERET
|
102
|
-
|
102
|
+
self.new_from_hebrew(year, 7, 22)
|
103
103
|
when :EREV_CHANUKAH
|
104
|
-
|
104
|
+
self.new_from_hebrew(year, 9, 24)
|
105
105
|
when :CHANUKAH
|
106
|
-
|
106
|
+
self.new_from_hebrew(year, 9, 25)
|
107
107
|
when :TZOM_TEVET
|
108
|
-
|
108
|
+
self.new_from_hebrew(year, 10, 10)
|
109
109
|
when :TU_BISHVAT
|
110
|
-
|
110
|
+
self.new_from_hebrew(year, 11, 15)
|
111
111
|
when :PURIM_KATAN
|
112
|
-
if
|
113
|
-
|
112
|
+
if self.hebrew_leap_year?(year)
|
113
|
+
self.new_from_hebrew(year, 12, 14)
|
114
114
|
end
|
115
115
|
when :TAANIT_ESTHER
|
116
|
-
date =
|
117
|
-
|
116
|
+
date = self.new_from_hebrew(year,
|
117
|
+
self.last_month_of_hebrew_year(year), 13)
|
118
118
|
if date.day == 7
|
119
119
|
date.set_hebrew_date(year, date.hebrew_month, 11)
|
120
120
|
elsif date.day == 6
|
@@ -122,11 +122,11 @@ module HebrewDateSupport
|
|
122
122
|
end
|
123
123
|
date
|
124
124
|
when :PURIM
|
125
|
-
|
126
|
-
|
125
|
+
self.new_from_hebrew(year,
|
126
|
+
self.last_month_of_hebrew_year(year), 14)
|
127
127
|
when :SHUSHAN_PURIM
|
128
|
-
|
129
|
-
|
128
|
+
self.new_from_hebrew(year,
|
129
|
+
self.last_month_of_hebrew_year(year), 15)
|
130
130
|
end
|
131
131
|
end
|
132
132
|
end
|
data/lib/support/parshiot.rb
CHANGED
@@ -189,7 +189,7 @@ module HebrewDateSupport
|
|
189
189
|
# index= the index number of the parsha name
|
190
190
|
array = []
|
191
191
|
# create a clone of this date
|
192
|
-
rosh_hashana =
|
192
|
+
rosh_hashana = self.class.new_from_hebrew(@hebrew_year, 7, 1)
|
193
193
|
|
194
194
|
# get day Rosh Hashana was on
|
195
195
|
rosh_hashana_day = rosh_hashana.day
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hebrew_date
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Orner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: yard
|