mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/optparse/version.rb: remove variable shadowing to stop
warning. [ruby-core:20612] * lib/irb/completion.rb, lib/net/imap.rb, lib/prime.rb, lib/rinda/ring.rb, lib/racc/parser.rb, lib/shell/command-processor.rb, lib/yaml/yamlnode.rb: ditto. * lib/racc/parser.rb: remove space before parentheses. * lib/shell/command-processor.rb, lib/shell/process-controller.rb: use parentheses around arguments. * lib/irb/ext/change-ws.rb, lib/rexml/validation/relaxng.rb, lib/yaml/baseemitter.rb: indentation fix. * lib/matrix.rb: small cosmetic change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20859 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
cd5c309542
commit
85bae86cb6
14 changed files with 319 additions and 330 deletions
|
@ -1,7 +1,7 @@
|
|||
# OptionParser internal utility
|
||||
|
||||
class << OptionParser
|
||||
def show_version(*pkg)
|
||||
def show_version(*pkgs)
|
||||
progname = ARGV.options.program_name
|
||||
result = false
|
||||
show = proc do |klass, cname, version|
|
||||
|
@ -19,14 +19,14 @@ class << OptionParser
|
|||
puts str
|
||||
result = true
|
||||
end
|
||||
if pkg.size == 1 and pkg[0] == "all"
|
||||
if pkgs.size == 1 and pkgs[0] == "all"
|
||||
self.search_const(::Object, /\AV(?:ERSION|ersion)\z/) do |klass, cname, version|
|
||||
unless cname[1] == ?e and klass.const_defined?(:Version)
|
||||
show.call(klass, cname.intern, version)
|
||||
end
|
||||
end
|
||||
else
|
||||
pkg.each do |pkg|
|
||||
pkgs.each do |pkg|
|
||||
begin
|
||||
pkg = pkg.split(/::|\//).inject(::Object) {|m, c| m.const_get(c)}
|
||||
v = case
|
||||
|
@ -46,8 +46,8 @@ class << OptionParser
|
|||
result
|
||||
end
|
||||
|
||||
def each_const(path, klass = ::Object)
|
||||
path.split(/::|\//).inject(klass) do |klass, name|
|
||||
def each_const(path, base = ::Object)
|
||||
path.split(/::|\//).inject(base) do |klass, name|
|
||||
raise NameError, path unless Module === klass
|
||||
klass.constants.grep(/#{name}/i) do |c|
|
||||
klass.const_defined?(c) or next
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue