Module: TestRocketLauncher

Defined in:
lib/testrocket/launcher.rb

Instance Method Summary collapse

Instance Method Details

#fire(d, &b) ⇒ Object



2
3
4
5
6
7
# File 'lib/testrocket/launcher.rb', line 2

def fire(d,&b)
  !->{ d.to_s }
  b.call
  r = "  /FIRED"
  (TestRocket.out || $>).puts r; r
end

#launcher(d, &b) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/testrocket/launcher.rb', line 8

def launcher(d,&b)
  $targets = 0; $hits = 0; $lost = 0
  (TestRocket.out || $>).puts "LAUNCHING '#{d}'"
  $launched = true
  b.call
  $launched = false
  r = "HIT #{$hits} of #{$targets} TARGET(S) AND MISSED #{$targets-$lost-$hits}, LOST #{$lost} ROCKET(S)"
  (TestRocket.out || $>).puts r; r
end