Sha256: d0f4d7bd45229372e7d24cf1bd08e7c5574c0379090fcd3f20a10fe02fda6ed3
Contents?: true
Size: 564 Bytes
Versions: 33
Compression:
Stored size: 564 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 module ClassMethods @@now = nil def now=(time) time = Time.parse(time) if time.instance_of?(String) @@now = time end def mutable_now #:nodoc: @@now || immutable_now end end end end
Version data entries
33 entries across 33 versions & 4 rubygems