Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Skip regular expression matcher deprecation warning

  • Loading branch information...
commit 4abb0b55f9c56f7a2411380fdedc0d79170b4ac7 1 parent 45b0be3
Christopher Patuzzo authored
Showing with 9 additions and 2 deletions.
  1. +0 −1  Readme.md
  2. +9 −1 lib/rubygems/dependent.rb
View
1  Readme.md
@@ -38,7 +38,6 @@ Output
TODO
=====
- - NOTE: Dependency.new w/ a regexp is deprecated. Dependency.new called from gem-dependent/lib/rubygems/dependent.rb:70
- include nested dependencies (a > b > c --> a = [b,c])
- add tests for cli interface
- add `--type development` support
View
10 lib/rubygems/dependent.rb
@@ -66,7 +66,7 @@ def self.all_specs_and_sources(options={})
all = true
matching_platform = false
prerelease = false
- matcher = Gem::Dependency.new(//, Gem::Requirement.default) # any name, any version
+ matcher = without_deprecation_warning { Gem::Dependency.new(//, Gem::Requirement.default) } # any name, any version
specs_and_sources = fetcher.find_matching matcher, all, matching_platform, prerelease
if options[:all_versions]
@@ -76,6 +76,14 @@ def self.all_specs_and_sources(options={})
end
end
+ def self.without_deprecation_warning(&block)
+ previous = Gem::Deprecate.skip
+ Gem::Deprecate.skip = true
+ yield
+ ensure
+ Gem::Deprecate.skip = previous
+ end
+
# get unique elements from an array (last found is used)
# http://drawohara.com/post/146659159/ruby-enumerable-uniq-by
def self.uniq_by(array, &block)
Please sign in to comment.
Something went wrong with that request. Please try again.