Created
September 8, 2010 00:16
-
-
Save pete/569372 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /usr/bin/env ruby | |
| def handle_input str | |
| if str.nil? | |
| puts "Bye." | |
| exit | |
| end | |
| puts "REVERSO: #{str.reverse}" | |
| end | |
| $stdout.sync = true # This forces the buffer to be flushed after every write. | |
| loop { | |
| print "prompt> " | |
| input = $stdin.gets | |
| handle_input input | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment