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
highline-1.7.2 examples/trapping_eof.rb
highline-1.7.1 examples/trapping_eof.rb
asana2flowdock-1.0.0 vendor/bundle/ruby/1.9.1/gems/highline-1.6.21/examples/trapping_eof.rb
clone-1.0.0.beta2 module/gems/highline-1.6.19/examples/trapping_eof.rb
clone-1.0.0.beta module/gems/highline-1.6.19/examples/trapping_eof.rb
highline-1.6.21 examples/trapping_eof.rb
highline-1.6.20 examples/trapping_eof.rb
challah-1.0.0 vendor/bundle/gems/highline-1.6.19/examples/trapping_eof.rb
sshp-0.0.2 vendor/ruby/1.9.1/gems/highline-1.6.19/examples/trapping_eof.rb
sshp-0.0.1 vendor/ruby/1.9.1/gems/highline-1.6.19/examples/trapping_eof.rb
highline-1.6.19 examples/trapping_eof.rb
challah-1.0.0.beta3 vendor/bundle/gems/highline-1.6.18/examples/trapping_eof.rb
challah-1.0.0.beta3 vendor/bundle/gems/highline-1.6.16/examples/trapping_eof.rb
highline-1.6.18 examples/trapping_eof.rb
highline-1.6.17 examples/trapping_eof.rb
challah-1.0.0.beta2 vendor/bundle/gems/highline-1.6.16/examples/trapping_eof.rb
challah-1.0.0.beta vendor/bundle/gems/highline-1.6.15/examples/trapping_eof.rb
challah-1.0.0.beta vendor/bundle/gems/highline-1.6.16/examples/trapping_eof.rb
highline-1.6.16 examples/trapping_eof.rb
challah-0.9.1.beta.3 vendor/bundle/gems/highline-1.6.15/examples/trapping_eof.rb