module Gem::CooldownSettings
The rules RubyGems and Bundler share for reading a configured cooldown period. Bundler ships a copy of this file, so it deliberately has no requires: none of the rest of RubyGems is guaranteed to be around it.
Public Class Methods
Source
# File lib/rubygems/cooldown_settings.rb, line 45 def self.combine(*values) values.filter_map {|value| days(value) }.max end
The cooldown that applies when RubyGems and Bundler are configured separately: the longest of values, so a cooldown configured for only one of the two tools protects both. Returns nil when none of them is usable.
A configured 0 takes part like any other value rather than switching the cooldown off, which leaves --cooldown 0 as the way to bypass a cooldown that the other tool configures.
Source
# File lib/rubygems/cooldown_settings.rb, line 18 def self.days(value) return if value.nil? # Base 10 explicitly: a leading zero is how a user writes a small number # of days, not a request for octal. days = Integer(value.to_s, 10, exception: false) days if days && !days.negative? end
Source
# File lib/rubygems/cooldown_settings.rb, line 31 def self.invalid?(value) !value.nil? && days(value).nil? end
True when value is configured but cannot be read as a number of days.