Sha256: 495558b8d7bb40e345e4471cdcb995d69fb4c3247ff6ca7b3bcebeef1af0c419

Contents?: true

Size: 414 Bytes

Versions: 83

Compression:

Stored size: 414 Bytes

Contents

#!/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

Version data entries

83 entries across 73 versions & 11 rubygems

Version Path
challah-0.7.0.pre vendor/bundle/gems/highline-1.6.13/examples/trapping_eof.rb
challah-0.6.2 vendor/bundle/gems/highline-1.6.13/examples/trapping_eof.rb
highline-1.6.13 examples/trapping_eof.rb