Class: HebCal::HolidaysHelper
- Inherits:
-
Object
- Object
- HebCal::HolidaysHelper
- Includes:
- Passover
- Defined in:
- lib/hebcal/holidaysHelper.rb
Instance Method Summary collapse
- #Distance(date1, date2) ⇒ Object
- #DistanceToPassover(date) ⇒ Object
- #InRange(distance, start, length) ⇒ Object
- #PesachAndYearLength(date) ⇒ Object
Methods included from Passover
Instance Method Details
#Distance(date1, date2) ⇒ Object
7 8 9 10 11 |
# File 'lib/hebcal/holidaysHelper.rb', line 7 def Distance date1, date2 date1 = (date1 + 60*60) if (!date2.dst? && date1.dst?) date2 = (date2 + 60*60) if (date2.dst? && !date1.dst?) (date2 - date1) / 24 / 60 / 60 end |
#DistanceToPassover(date) ⇒ Object
13 14 15 |
# File 'lib/hebcal/holidaysHelper.rb', line 13 def DistanceToPassover date Distance WhenIsPesach(date.year), date end |
#InRange(distance, start, length) ⇒ Object
17 18 19 |
# File 'lib/hebcal/holidaysHelper.rb', line 17 def InRange distance, start, length (distance >= start) && (distance <= start + length - 1) end |
#PesachAndYearLength(date) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/hebcal/holidaysHelper.rb', line 21 def PesachAndYearLength date pesach1 = WhenIsPesach(date.year) if (Distance(pesach1, date) < -59) then pesach2 = pesach1 pesach1 = WhenIsPesach(pesach1.year - 1) else pesach2 = WhenIsPesach(pesach1.year + 1) end length = Distance pesach1, pesach2 { :pesach => pesach1, :length => length} end |