Sha256: bcf941f34a09af2d33f22e05a9d47ed84790f8481b23f9aa5deaff5089eb28b7
Contents?: true
Size: 643 Bytes
Versions: 1
Compression:
Stored size: 643 Bytes
Contents
require 'time' module TimeTravel module TimeExtensions def self.included(base) base.extend(ClassMethods) base.class_eval do class << self alias_method :immutable_now, :now alias_method :now, :mutable_now end end base.now = nil end def closest_second Time.gm(year, month, day, hour, min, sec) end module ClassMethods @@now = nil def now=(value) @@now = value.respond_to?(:parse_to_time) ? value.parse_to_time : value end def mutable_now #:nodoc: @@now || immutable_now end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
time_travel-0.1.0 | lib/time_travel/time_extensions.rb |