Sha256: 173af29462c6adf9ec70ce106b2c0ee1708c4f8d01c6a356b41fd33427cc692a

Contents?: true

Size: 592 Bytes

Versions: 1

Compression:

Stored size: 592 Bytes

Contents

require "./lib/kommando"

k = Kommando.new "$ echo hello"
ended = false
got_start = false
got_exit = false
got_start_when_given_as_symbol = false

k.when "start" do
  got_start = true
  puts "start!"
  raise "code in start" if k.code
  raise "ended in start" if ended
end

k.when :start do
  puts ":start!"
  got_start_when_given_as_symbol = true
end

k.when :exit do
  got_exit = true
end

k.run
ended = true

raise "got_start not set" unless got_start
raise "got_start_when_given_as_symbol not set" unless got_start_when_given_as_symbol
raise "got_exit not set" unless got_exit

puts "end"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kommando-0.0.15 examples/when.rb