/usr/share/doc/ruby-highline/examples/trapping_eof.rb is in ruby-highline 1.6.20-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #!/usr/bin/env ruby
# 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
|