Class: BundleHack::GemspecSources::Rubygems

Inherits:
Base
  • Object
show all
Defined in:
lib/bundle_hack/gemspec_sources/rubygems.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from BundleHack::GemspecSources::Base

Instance Method Details

#specObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/bundle_hack/gemspec_sources/rubygems.rb', line 6

def spec
  dependency = ::Gem::Dependency.new(@gem.name, @gem.version)

  # Borrowed from:
  # https://ruby-doc.org/stdlib-2.5.3/libdoc/rubygems/rdoc/Gem.html#method-c-latest_spec_for
  spec_tuples, = ::Gem::SpecFetcher.fetcher.spec_for_dependency(
    dependency
  )
  spec, = spec_tuples.first
  return nil if spec.nil?

  spec.to_ruby
end