Permalink
Browse files

Cleanup warnings in RubyGems backports

  • Loading branch information...
1 parent 89f64b8 commit e72ae7c325fb4990c0f8ef1ee7d189aeb8b0093d @lsegal committed Aug 6, 2012
Showing with 23 additions and 5 deletions.
  1. +6 −5 lib/yard/rubygems/backports/gem.rb
  2. +17 −0 lib/yard/rubygems/backports/source_index.rb
@@ -1,8 +1,9 @@
module Gem
- ##
- # Returns the Gem::SourceIndex of specifications that are in the Gem.path
-
- def self.source_index
- @@source_index ||= SourceIndex.from_installed_gems
+ class << self
+ undef source_index
+ # Returns the Gem::SourceIndex of specifications that are in the Gem.path
+ def source_index
+ @@source_index ||= SourceIndex.from_installed_gems
+ end
end
end
@@ -18,6 +18,15 @@
# YAMLized source index objects to load properly.
class Gem::SourceIndex
+ # Undef old methods
+ alias old_initialize initialize
+ undef old_initialize
+ %w(all_gems prerelease_gems load_gems_in latest_specs prerelease_specs
+ released_specs add_spec add_specs remove_spec each specification
+ index_signature gem_signature size length find_name search released_gems
+ refresh! outdated == dump gems spec_dirs spec_dirs=).each do |meth|
+ undef_method(meth) if method_defined?(meth)
+ end
include Enumerable
@@ -29,6 +38,14 @@ class Gem::SourceIndex
attr_accessor :spec_dirs
class << self
+ # Undef old methods
+ %w(from_installed_gems installed_spec_directories
+ from_gems_in load_specification).each do |meth|
+ if instance_methods(true).find {|m| m.to_s == meth }
+ undef_method(meth)
+ end
+ end
+
##
# Factory method to construct a source index instance for a given
# path.

0 comments on commit e72ae7c

Please sign in to comment.