lib/et-orbi/time.rb in et-orbi-1.2.10 vs lib/et-orbi/time.rb in et-orbi-1.2.11
- old
+ new
@@ -94,11 +94,12 @@
# Nullify the "caches" used by #to_time, #rweek, and others
#
def touch
@time = nil
- @ref = nil
+ @rday = nil
+ @rweek = nil
end
def seconds=(f)
@seconds = f
@@ -351,23 +352,27 @@
# "reference week", used in fugit for cron modulo notation
#
def rweek
- @ref ||= EtOrbi.make_time('2019-01-01 12:00:00', @zone)
- noon = EtOrbi.make_time(strftime('%F 12:00:00'), @zone)
-
- ((noon - @ref) / WEEK_S).floor + 1
+ @rweek ||=
+ begin
+ ref = EtOrbi.make_time('2019-01-01 12:00:00', @zone)
+ noon = EtOrbi.make_time(strftime('%F 12:00:00'), @zone)
+ ((noon - ref) / WEEK_S).floor + 1
+ end
end
# "reference week", used in fugit for cron modulo notation
#
def rday
- @ref ||= EtOrbi.make_time('2019-01-01 12:00:00', @zone)
- noon = EtOrbi.make_time(strftime('%F 12:00:00'), @zone)
-
- ((noon - @ref) / DAY_S).floor + 1
+ @rday ||=
+ begin
+ ref = EtOrbi.make_time('2019-01-01 12:00:00', @zone)
+ noon = EtOrbi.make_time(strftime('%F 12:00:00'), @zone)
+ ((noon - ref) / DAY_S).floor + 1
+ end
end
def reach(points)
t = EoTime.new(self.to_f, @zone)