Class: BundleSafeUpdate::RiskChecker

Inherits:
Object
  • Object
show all
Defined in:
lib/bundle_safe_update/risk_checker.rb

Defined Under Namespace

Classes: RiskResult, RiskSignal

Constant Summary collapse

SECONDS_PER_YEAR =
365.25 * 24 * 60 * 60

Instance Method Summary collapse

Constructor Details

#initialize(config:, api: nil, cache: nil, lockfile_parser: nil, max_threads: nil) ⇒ RiskChecker

Returns a new instance of RiskChecker.



12
13
14
15
16
17
18
# File 'lib/bundle_safe_update/risk_checker.rb', line 12

def initialize(config:, api: nil, cache: nil, lockfile_parser: nil, max_threads: nil)
  @config = config
  @api = api || RubygemsApi.new
  @cache = cache || RiskCache.new
  @lockfile_parser = lockfile_parser || LockfileParser.new
  @max_threads = max_threads || @config.max_threads
end

Instance Method Details

#check_all(gem_results) ⇒ Object



20
21
22
23
24
# File 'lib/bundle_safe_update/risk_checker.rb', line 20

def check_all(gem_results)
  return [] if gem_results.empty?

  check_all_parallel(gem_results)
end

#save_cacheObject



26
27
28
# File 'lib/bundle_safe_update/risk_checker.rb', line 26

def save_cache
  @cache.save
end