Class: BundleHack::GemspecSources::Cache

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

Overview

I couldn’t figure out how to do this with ‘Gem` directly so I’ve implemented it myself instead - if this can be collapsed into something along the lines of ‘Gem.from_cache(gem_name, gem_version)` then that would mean all of this code can go away.

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

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

Instance Method Details

#specObject



10
11
12
13
14
15
16
17
# File 'lib/bundle_hack/gemspec_sources/cache.rb', line 10

def spec
  path = cache_file_path
  return nil if path.nil?

  # rubocop:disable Security/MarshalLoad
  Marshal.load(File.read(cache_file_path)).to_ruby
  # rubocop:enable Security/MarshalLoad
end