Sha256: 47e0b8f6bb235baa8ce3aef01f7eba9d1d9d9579350da4ab95d05a5be2f79bc3
Contents?: true
Size: 568 Bytes
Versions: 1
Compression:
Stored size: 568 Bytes
Contents
require 'quantum_leap/version' module QuantumLeap extend self def time_travel_offsets @time_travel_offsets ||= [] end def reset @time_travel_offsets = [] end def mock_current_time(new_time) time_travel_offsets.push(Time.now - new_time) end def now Time.really_now - time_travel_offsets.inject(0, :+) end end class << Time alias_method :really_now, :now def now; QuantumLeap.now; end end class Quantum def self.leap(time) QuantumLeap.mock_current_time(time) end def self.leap_back QuantumLeap.reset end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
quantum_leap-0.1.0 | lib/quantum_leap.rb |