summaryrefslogtreecommitdiff
path: root/sample/eval.rb
diff options
context:
space:
mode:
Diffstat (limited to 'sample/eval.rb')
-rw-r--r--sample/eval.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/sample/eval.rb b/sample/eval.rb
index da31b77153..216bf8ca39 100644
--- a/sample/eval.rb
+++ b/sample/eval.rb
@@ -1,9 +1,10 @@
line = ''
indent=0
+$stdout.sync = TRUE
print "ruby> "
while TRUE
l = gets
- if not l
+ unless l
break if line == ''
else
line = line + l
@@ -17,7 +18,7 @@ while TRUE
if l =~ /^\s*end\b[^_]/
indent -= 1
end
- if l =~ /{\s*(\|.*\|)?\s*$/
+ if l =~ /\{\s*(\|.*\|)?\s*$/
indent += 1
end
if l =~ /^\s*\}/
@@ -31,7 +32,7 @@ while TRUE
begin
print eval(line).inspect, "\n"
rescue
- $! = 'exception raised' if not $!
+ $! = 'exception raised' unless $!
print "ERR: ", $!, "\n"
end
break if not l