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
brakeman-4.3.1 bundle/ruby/2.5.0/gems/highline-1.7.10/examples/trapping_eof.rb
brakeman-4.3.0 bundle/ruby/2.5.0/gems/highline-1.7.10/examples/trapping_eof.rb
brakeman-4.2.1 bundle/ruby/2.5.0/gems/highline-1.7.10/examples/trapping_eof.rb
brakeman-4.2.0 bundle/ruby/2.3.0/gems/highline-1.7.10/examples/trapping_eof.rb
brakeman-4.1.1 bundle/ruby/2.3.0/gems/highline-1.7.10/examples/trapping_eof.rb
brakeman-4.1.0 bundle/ruby/2.3.0/gems/highline-1.7.10/examples/trapping_eof.rb
highline-1.7.10 examples/trapping_eof.rb
brakeman-4.0.1 bundle/ruby/2.3.0/gems/highline-1.7.8/examples/trapping_eof.rb
brakeman-4.0.1.pre1 bundle/ruby/2.3.0/gems/highline-1.7.8/examples/trapping_eof.rb
brakeman-4.0.0 bundle/ruby/2.3.0/gems/highline-1.7.8/examples/trapping_eof.rb
brakeman-3.7.2 bundle/ruby/2.3.0/gems/highline-1.7.8/examples/trapping_eof.rb
brakeman-3.7.1 bundle/ruby/2.3.0/gems/highline-1.7.8/examples/trapping_eof.rb
brakeman-3.7.0 bundle/ruby/2.3.0/gems/highline-1.7.8/examples/trapping_eof.rb
highline-2.0.0.pre.develop.9 examples/trapping_eof.rb
brakeman-3.6.2 bundle/ruby/2.3.0/gems/highline-1.7.8/examples/trapping_eof.rb
brakeman-3.6.1 bundle/ruby/2.3.0/gems/highline-1.7.8/examples/trapping_eof.rb
brakeman-3.6.0 bundle/ruby/2.3.0/gems/highline-1.7.8/examples/trapping_eof.rb
brakeman-3.5.0 bundle/ruby/2.3.0/gems/highline-1.7.8/examples/trapping_eof.rb
brakeman-3.4.1 bundle/ruby/2.3.0/gems/highline-1.7.8/examples/trapping_eof.rb
brakeman-3.4.0 bundle/ruby/2.3.0/gems/highline-1.7.8/examples/trapping_eof.rb