Sha256: c2ca7378285fd246e4602089f156ae3e80ad4fb4a082a7f3cd1c57732a368079

Contents?: true

Size: 469 Bytes

Versions: 1

Compression:

Stored size: 469 Bytes

Contents

require 'quantum_leap/version'

module QuantumLeap
  extend self

  def time_travel_offsets
    @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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quantum_leap-0.0.3 lib/quantum_leap.rb