module Shabbat

Constants

VERSION

Public Instance Methods

last_shabbat() click to toggle source
# File lib/shabbat/shabbat.rb, line 14
def last_shabbat
  if shabbat?
    to_date - 1.week
  else
    day = to_date
    diff = day.wday + 1
    day - diff.days
  end
end
next_shabbat() click to toggle source
# File lib/shabbat/shabbat.rb, line 7
def next_shabbat
  if shabbat?
    to_date + 1.week
  else
    last_shabbat + 1.week
  end
end
shabbat?() click to toggle source
# File lib/shabbat/shabbat.rb, line 4
def shabbat?
  to_date.saturday?
end