Module: GitTimeMachine::TravelThroughTime
- Defined in:
- lib/git_time_machine.rb
Defined Under Namespace
Classes: LawsOfPhysicsError
Class Method Summary
collapse
Class Method Details
.can_travel_through_time?(time_machine) ⇒ Boolean
22
23
24
25
|
# File 'lib/git_time_machine.rb', line 22
def self.can_travel_through_time?(time_machine)
time_machine.flux_capacitated? &&
(time_machine.velocity >= 88)
end
|
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/git_time_machine.rb', line 27
def self.perform_status_check(time_machine)
print "Checking flux"
3.times do
sleep 1
print '.'
end
puts "\nFlux status: #{time_machine.flux_capacitated?}"
print "Checking velocity"
3.times do
sleep 1
print '.'
end
puts "\nVelocity: #{time_machine.velocity}"
end
|
.travel_through_time ⇒ Object
8
9
10
11
12
13
14
15
16
17
18
|
# File 'lib/git_time_machine.rb', line 8
def self.travel_through_time
time_machine = TimeMachine.new
time_machine.get_ready!
perform_status_check(time_machine)
if can_travel_through_time?(time_machine)
time_machine.back_to "1955"
else
raise LawsOfPhysicsError, 'Cannot Travel Through Time'
end
end
|