Skip to content
Browse files

Use private instead of _XXX

This change does it against only Specification._each_spec,
_each_normal and _each_default. We should change other methods such as
_all and _resort! but it is not a work for this branch.

Suggested by Evan Phoenix. Thanks!!!
  • Loading branch information...
1 parent d333341 commit d598fdcc8e035731b9df1487dc4d0d64b96c382c @kou committed
Showing with 20 additions and 17 deletions.
  1. +20 −17 lib/rubygems/specification.rb
View
37 lib/rubygems/specification.rb
@@ -611,33 +611,36 @@ def test_files= files
attr_accessor :specification_version
- def self._each_spec(gemspec_glob) # :nodoc:
- self.dirs.each { |dir|
- Dir[File.join(dir, gemspec_glob)].each { |path|
- spec = Gem::Specification.load path.untaint
- # #load returns nil if the spec is bad, so we just ignore
- # it at this stage
- yield(spec) if spec
+ class << self
+ private
+ def each_spec(gemspec_glob) # :nodoc:
+ self.dirs.each { |dir|
+ Dir[File.join(dir, gemspec_glob)].each { |path|
+ spec = Gem::Specification.load path.untaint
+ # #load returns nil if the spec is bad, so we just ignore
+ # it at this stage
+ yield(spec) if spec
+ }
}
- }
- end
+ end
- def self._each_default(&block) # :nodoc:
- _each_spec(File.join("default", "*.gemspec"), &block)
- end
+ def each_default(&block) # :nodoc:
+ each_spec(File.join("default", "*.gemspec"), &block)
+ end
- def self._each_normal(&block) # :nodoc:
- _each_spec("*.gemspec", &block)
+ def each_normal(&block) # :nodoc:
+ each_spec("*.gemspec", &block)
+ end
end
def self._all # :nodoc:
unless defined?(@@all) && @@all then
specs = {}
- _each_default do |spec|
+ each_default do |spec|
specs[spec.full_name] ||= spec
end
- _each_normal do |spec|
+ each_normal do |spec|
specs[spec.full_name] ||= spec
end
@@ -660,7 +663,7 @@ def self._resort! # :nodoc:
# Loads the default specifications. It should be called only once.
def self.load_defaults
- _each_default do |spec|
+ each_default do |spec|
Gem.register_default_spec(spec)
end
end

0 comments on commit d598fdc

Please sign in to comment.
Something went wrong with that request. Please try again.