From 590a37880c46ce080dde5864497758e0a83a24f4 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 16 Jun 2003 07:14:50 +0000 Subject: * eval.c (proc_alloc): re-unification of Block and Proc. Block class is no longer available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3948 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/irb/ruby-lex.rb | 4 ++-- lib/mkmf.rb | 2 +- lib/net/imap.rb | 4 ++-- lib/optparse.rb | 30 +++++++++++++++--------------- lib/rexml/parsers/sax2parser.rb | 2 +- lib/tracer.rb | 2 +- 6 files changed, 22 insertions(+), 22 deletions(-) (limited to 'lib') diff --git a/lib/irb/ruby-lex.rb b/lib/irb/ruby-lex.rb index 4b58ba6fd5..3b62ef8676 100644 --- a/lib/irb/ruby-lex.rb +++ b/lib/irb/ruby-lex.rb @@ -74,7 +74,7 @@ class RubyLex elsif block_given? @input = block else - @input = Block.new{@io.gets} + @input = Proc.new{@io.gets} end end @@ -188,7 +188,7 @@ class RubyLex if p.respond_to?(:call) @prompt = p else - @prompt = Block.new{print p} + @prompt = Proc.new{print p} end end diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 32e76d7dca..b0b3817b54 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -833,7 +833,7 @@ Config::CONFIG["topdir"] = CONFIG["topdir"] = $configure_args["--topdir"] ||= $curdir $ruby = arg_config("--ruby", CONFIG["ruby_install_name"]) -split = Shellwords.method(:shellwords).to_block +split = Shellwords.method(:shellwords).to_proc EXPORT_PREFIX = config_string('EXPORT_PREFIX') {|s| s.strip} diff --git a/lib/net/imap.rb b/lib/net/imap.rb index 1007f2bdf6..2cbb408168 100644 --- a/lib/net/imap.rb +++ b/lib/net/imap.rb @@ -263,7 +263,7 @@ Object If this mailbox exists, an array containing objects of (()) will be returned. -: add_response_handler(handler = Block.new) +: add_response_handler(handler = Proc.new) Adds a response handler. ex). @@ -1047,7 +1047,7 @@ module Net return sort_internal("UID SORT", sort_keys, search_keys, charset) end - def add_response_handler(handler = Block.new) + def add_response_handler(handler = Proc.new) @response_handlers.push(handler) end diff --git a/lib/optparse.rb b/lib/optparse.rb index 7a2cfc49c9..50d72f8a2e 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -167,7 +167,7 @@ Individual switch class. =end #'#"#`# def initialize(pattern = nil, conv = nil, short = nil, long = nil, arg = nil, - desc = ([] if short or long), block = Block.new) + desc = ([] if short or long), block = Proc.new) @pattern, @conv, @short, @long, @arg, @desc, @block = pattern, conv, short, long, arg, desc, block end @@ -414,7 +414,7 @@ summary feature. pat = t if t.respond_to?(:match) end unless block - block = pat.method(:convert).to_block if pat.respond_to?(:convert) + block = pat.method(:convert).to_proc if pat.respond_to?(:convert) end @atype[t] = [pat, block] end @@ -482,7 +482,7 @@ summary feature. searching list. : ((|k|)) searching key. - : (({Block})) + : (({block})) yielded with the found value when succeeded. =end #'#"#`# def search(id, key) @@ -503,7 +503,7 @@ summary feature. searching key. : ((|*pat|)) optional pattern for completion. - : (({Block})) + : (({block})) yielded with the found value when succeeded. =end #'#"#`# def complete(id, opt, *pat, &block) @@ -634,7 +634,7 @@ Default options, which never appear in option summary. summary width. : ((|indent|)) summary indent. - : (({Block})) + : (({block})) to be evaluated in the new instance context. =end #'#"#`# def self.with(*args, &block) @@ -670,7 +670,7 @@ Default options, which never appear in option summary. summary width. : ((|indent|)) summary indent. - : (({Block})) + : (({block})) to be evaluated in the new instance context. =end #'#"#`# def initialize(banner = nil, width = 32, indent = ' ' * 4) @@ -709,7 +709,7 @@ Default options, which never appear in option summary. argument class specifier, any object including Class. : ((|pat|)) pattern for argument, defaulted to ((|t|)) if it respond to (({match})). - : (({Block})) + : (({block})) receives argument string and should be convert to desired class. =end #'#"#`# def accept(*args, &blk) top.accept(*args, &blk) end @@ -842,7 +842,7 @@ Default options, which never appear in option summary. maximum length allowed for left side. Defaulted to (({((|width|)) - 1})) : ((|indent|)) indentation. Defaulted to ((|@summary_indent|)) - : (({Block})) + : (({block})) yields with each line if called as iterator. =end #'#"#`# def summarize(to = [], width = @summary_width, max = width - 1, indent = @summary_indent, &blk) @@ -898,7 +898,7 @@ Default options, which never appear in option summary. argument style and description. : "description", ... ((*description*)) for this option. - : (({Block})) + : (({block})) ((*handler*)) to convert option argument to arbitrary (({Class})). =end #'#"#`# =begin private @@ -949,7 +949,7 @@ Default options, which never appear in option summary. # directly specified pattern(any object possible to match) if !(String === o) and o.respond_to?(:match) pattern = notwice(o, pattern, 'pattern') - conv = (pattern.method(:convert).to_block if pattern.respond_to?(:convert)) + conv = (pattern.method(:convert).to_proc if pattern.respond_to?(:convert)) next end @@ -962,7 +962,7 @@ Default options, which never appear in option summary. when CompletingHash when nil pattern = CompletingHash.new - conv = (pattern.method(:convert).to_block if pattern.respond_to?(:convert)) + conv = (pattern.method(:convert).to_proc if pattern.respond_to?(:convert)) else raise ArgumentError, "argument pattern given twice" end @@ -1107,7 +1107,7 @@ Default options, which never appear in option summary. :Parameters: : ((|argv|)) command line arguments to be parsed. - : (({Block})) + : (({block})) called with each non-option argument. =end #'#"#`# def order(*argv, &block) order!(argv, &block) end @@ -1233,7 +1233,7 @@ Default options, which never appear in option summary. called method in each elements of (({stack}))s. : ((|*args|)) passed to ((|id|)). - : (({Block})) + : (({block})) passed to ((|id|)). =end #'#"#`# def visit(id, *args, &block) @@ -1254,7 +1254,7 @@ Default options, which never appear in option summary. searching table. : ((|k|)) searching key. - : (({Block})) + : (({block})) yielded with the found value when succeeded. =end #'#"#`# def search(id, k) @@ -1276,7 +1276,7 @@ Default options, which never appear in option summary. searching key. : ((|*pat|)) optional pattern for completion. - : (({Block})) + : (({block})) yielded with the found value when succeeded. =end #'#"#`# def complete(typ, opt, *pat) diff --git a/lib/rexml/parsers/sax2parser.rb b/lib/rexml/parsers/sax2parser.rb index 4cddc4806d..2280b983a3 100644 --- a/lib/rexml/parsers/sax2parser.rb +++ b/lib/rexml/parsers/sax2parser.rb @@ -185,7 +185,7 @@ module REXML end def add( pair ) - if pair[-1].kind_of? Proc or (defined? Block and pair[-1].kind_of? Block) + if pair[-1].respond_to? :call @procs << pair unless @procs.include? pair else @listeners << pair unless @listeners.include? pair diff --git a/lib/tracer.rb b/lib/tracer.rb index 673290c2ab..3ccf1b5017 100644 --- a/lib/tracer.rb +++ b/lib/tracer.rb @@ -62,7 +62,7 @@ class Tracer off end else - set_trace_func method(:trace_func).to_block + set_trace_func method(:trace_func).to_proc stdout.print "Trace on\n" if Tracer.verbose? end end -- cgit v1.2.3