summaryrefslogtreecommitdiff
path: root/lib/irb
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-10 05:22:17 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-10 05:22:17 +0000
commit373a59b95b71b54b99a0ba229cd5860fac308115 (patch)
tree28f8c503efdbf7bfc9a70f33aec63933bbb7c1ac /lib/irb
parent434e71244a50ff874a14113e7cc46ce02bacb34e (diff)
* lib/irb.rb (IRB::Irb::eval_input): warn and exit if $SAFE >=3
after input evaluation. * lib/irb.rb (IRB::Irb::eval_input): untaint input string. now irb works for levels 1 and 2. * ext/syck/rubyext.c (syck_loader_transfer): should not use rb_cProc directly, since type_proc may be Proc, Block, or Method. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/irb')
-rw-r--r--lib/irb/ruby-lex.rb12
-rw-r--r--lib/irb/slex.rb4
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb
index 26b0b3b..8d5cb47 100644
--- a/lib/irb/ruby-lex.rb
+++ b/lib/irb/ruby-lex.rb
@@ -69,12 +69,12 @@ class RubyLex
# io functions
def set_input(io, p = nil)
@io = io
- if p.kind_of?(Proc)
+ if p.respond_to?(:call)
@input = p
elsif iterator?
- @input = proc
+ @input = Block.new
else
- @input = proc{@io.gets}
+ @input = Block.new{@io.gets}
end
end
@@ -183,11 +183,11 @@ class RubyLex
end
private :buf_input
- def set_prompt(p = proc)
- if p.kind_of?(Proc)
+ def set_prompt(p = Block.new)
+ if p.respond_to?(:call)
@prompt = p
else
- @prompt = proc{print p}
+ @prompt = Block.new{print p}
end
end
diff --git a/lib/irb/slex.rb b/lib/irb/slex.rb
index 1cf2325..5dc496d 100644
--- a/lib/irb/slex.rb
+++ b/lib/irb/slex.rb
@@ -33,13 +33,13 @@ class SLex
def def_rule(token, preproc = nil, postproc = nil)
# print node.inspect, "\n" if SLex.debug?
- postproc = proc if iterator?
+ postproc = Block.new if iterator?
node = create(token, preproc, postproc)
end
def def_rules(*tokens)
if iterator?
- p = proc
+ p = Block.new
end
for token in tokens
def_rule(token, nil, p)