Module: Delorean::FluxCapacitor
- Included in:
- Delorean
- Defined in:
- lib/flux_capacitor.rb
Instance Method Summary collapse
- #back_to_the_present ⇒ Object (also: #back_to_1985)
- #jump(seconds) ⇒ Object
- #now ⇒ Object
- #time_travel_to(time, options = {}) ⇒ Object
Instance Method Details
#back_to_the_present ⇒ Object Also known as: back_to_1985
13 14 15 |
# File 'lib/flux_capacitor.rb', line 13 def back_to_the_present reset end |
#jump(seconds) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/flux_capacitor.rb', line 18 def jump(seconds) mock_current_time Time.now + seconds return unless block_given? begin yield ensure restore_previous_time end end |
#now ⇒ Object
28 29 30 |
# File 'lib/flux_capacitor.rb', line 28 def now Time.now_without_delorean - time_travel_offsets.inject(0){ |sum, val| sum + val } end |
#time_travel_to(time, options = {}) ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/flux_capacitor.rb', line 3 def time_travel_to(time, ={}) mock_current_time(time, ) return unless block_given? begin yield ensure restore_previous_time end end |