Sha256: acea6be477209fd59e9204b106278f09c93251a6c99f529f119d5a1de06e8e6c

Contents?: true

Size: 431 Bytes

Versions: 18

Compression:

Stored size: 431 Bytes

Contents

#!/usr/bin/env ruby
# encoding: utf-8

# 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

18 entries across 18 versions & 2 rubygems

Version Path
highline-3.1.2 examples/trapping_eof.rb
highline-3.1.1 examples/trapping_eof.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/highline-3.0.1/examples/trapping_eof.rb
highline-3.1.0 examples/trapping_eof.rb
highline-3.0.1 examples/trapping_eof.rb
highline-3.0.0 examples/trapping_eof.rb
highline-3.0.0.pre.1 examples/trapping_eof.rb
highline-2.1.0 examples/trapping_eof.rb
highline-2.0.3 examples/trapping_eof.rb
highline-2.0.2 examples/trapping_eof.rb
highline-2.0.1 examples/trapping_eof.rb
highline-2.0.0 examples/trapping_eof.rb
highline-2.0.0.pre.develop.16 examples/trapping_eof.rb
highline-2.0.0.pre.develop.15 examples/trapping_eof.rb
highline-2.0.0.pre.develop.14 examples/trapping_eof.rb
highline-2.0.0.pre.develop.13 examples/trapping_eof.rb
highline-2.0.0.pre.develop.12 examples/trapping_eof.rb
highline-2.0.0.pre.develop.11 examples/trapping_eof.rb