diff options
| author | mo khan <mo.khan@gmail.com> | 2020-06-07 15:59:35 -0600 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-06-07 15:59:35 -0600 |
| commit | 9228a534de29226c4b00456583c463ec7e078d67 (patch) | |
| tree | 17724154abec288e65eca841de50bade7e7b637a /lib | |
| parent | 9009375d9892b15dd0d4898dcdea2a6308f93d58 (diff) | |
Extract method to cleanup pypi path
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/spandx/python/pypi.rb | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/spandx/python/pypi.rb b/lib/spandx/python/pypi.rb index de469d7..ef3080a 100644 --- a/lib/spandx/python/pypi.rb +++ b/lib/spandx/python/pypi.rb @@ -49,9 +49,7 @@ module Spandx end def version_from(url) - path = SUBSTITUTIONS.inject(URI.parse(url).path.split('/')[-1]) do |memo, item| - memo.gsub(item, '') - end + path = cleanup(url) return if path.rindex('-').nil? section = path.scan(/-\d+\..*/) @@ -65,6 +63,12 @@ module Spandx attr_reader :http + def cleanup(url) + SUBSTITUTIONS.inject(URI.parse(url).path.split('/')[-1]) do |memo, item| + memo.gsub(item, '') + end + end + def sources_for(dependency) return default_sources if dependency.meta.empty? |
