Sha256: 575fc30afa16755277892364a646ae0110b9ff5a34997a17730fcc70a55dd625
Contents?: true
Size: 689 Bytes
Versions: 3
Compression:
Stored size: 689 Bytes
Contents
# frozen_string_literal: true module ChronoTrigger module Helpers module MITF class LostInTimeError < StandardError end class TodayIsTomorrowsYesterday < StandardError end def moment_in_the_future(time_with_zone) raise(LostInTimeError, "Argument must be of type ActiveSupport::TimeWithZone eg. right_now + 1.second") unless time_with_zone.is_a?(ActiveSupport::TimeWithZone) raise(TodayIsTomorrowsYesterday, "Time must be in the future eg. 1.second.from_now") unless time_with_zone.future? Time.zone.today + time_with_zone.hour.hours + time_with_zone.min.minutes + time_with_zone.sec.seconds end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
chrono_trigger-1.0.5 | lib/chrono_trigger/helpers/mitf.rb |
chrono_trigger-1.0.4 | lib/chrono_trigger/helpers/mitf.rb |
chrono_trigger-1.0.3 | lib/chrono_trigger/helpers/mitf.rb |