mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-11 18:04:22 +01:00
22 lines
419 B
Ruby
22 lines
419 B
Ruby
#!/usr/local/bin/ruby -w
|
|
|
|
# trapping_eof.rb
|
|
#
|
|
# Created by James Edward Gray II on 2006-02-20.
|
|
# Copyright 2006 Gray Productions. All rights reserved.
|
|
|
|
require "rubygems"
|
|
require "highline/import"
|
|
|
|
loop do
|
|
begin
|
|
name = ask("What's your name?")
|
|
break if name == "exit"
|
|
puts "Hello, #{name}!"
|
|
rescue EOFError # HighLine throws this if @input.eof?
|
|
break
|
|
end
|
|
end
|
|
|
|
puts "Goodbye, dear friend."
|
|
exit
|