Skip to content
This repository
Browse code

Cleanup warnings in RubyGems backports

  • Loading branch information...
commit e72ae7c325fb4990c0f8ef1ee7d189aeb8b0093d 1 parent 89f64b8
Loren Segal authored
11 lib/yard/rubygems/backports/gem.rb
... ... @@ -1,8 +1,9 @@
1 1 module Gem
2   - ##
3   - # Returns the Gem::SourceIndex of specifications that are in the Gem.path
4   -
5   - def self.source_index
6   - @@source_index ||= SourceIndex.from_installed_gems
  2 + class << self
  3 + undef source_index
  4 + # Returns the Gem::SourceIndex of specifications that are in the Gem.path
  5 + def source_index
  6 + @@source_index ||= SourceIndex.from_installed_gems
  7 + end
7 8 end
8 9 end
17 lib/yard/rubygems/backports/source_index.rb
@@ -18,6 +18,15 @@
18 18 # YAMLized source index objects to load properly.
19 19
20 20 class Gem::SourceIndex
  21 + # Undef old methods
  22 + alias old_initialize initialize
  23 + undef old_initialize
  24 + %w(all_gems prerelease_gems load_gems_in latest_specs prerelease_specs
  25 + released_specs add_spec add_specs remove_spec each specification
  26 + index_signature gem_signature size length find_name search released_gems
  27 + refresh! outdated == dump gems spec_dirs spec_dirs=).each do |meth|
  28 + undef_method(meth) if method_defined?(meth)
  29 + end
21 30
22 31 include Enumerable
23 32
@@ -29,6 +38,14 @@ class Gem::SourceIndex
29 38 attr_accessor :spec_dirs
30 39
31 40 class << self
  41 + # Undef old methods
  42 + %w(from_installed_gems installed_spec_directories
  43 + from_gems_in load_specification).each do |meth|
  44 + if instance_methods(true).find {|m| m.to_s == meth }
  45 + undef_method(meth)
  46 + end
  47 + end
  48 +
32 49 ##
33 50 # Factory method to construct a source index instance for a given
34 51 # path.

0 comments on commit e72ae7c

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