Created
February 23, 2019 10:31
-
-
Save pirj/9d28e54be56e07a3c0a47c20a11615d0 to your computer and use it in GitHub Desktop.
Ruby REPL when `pry` is not there
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
while(true) do | |
begin | |
print '> ' | |
input = STDIN.readline.chop | |
output = eval(input) | |
puts "=> #{output}" | |
rescue StandardError => e | |
puts "Error: #{e.message}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment