Class: Bundler::Restrict::Checks::DateCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/restrict/checks/date_check.rb

Instance Method Summary collapse

Constructor Details

#initialize(gem_version) ⇒ DateCheck

Returns a new instance of DateCheck.



7
8
9
# File 'lib/bundler/restrict/checks/date_check.rb', line 7

def initialize(gem_version)
  @gem_version = gem_version
end

Instance Method Details

#errorObject



19
20
21
22
23
# File 'lib/bundler/restrict/checks/date_check.rb', line 19

def error
  return if valid?

  "Please downgrade '#{@gem_version.name}' version '#{@gem_version.number}: release date '#{@gem_version.release_date}' >= #{z_date}"
end

#valid?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/bundler/restrict/checks/date_check.rb', line 15

def valid?
  @gem_version.release_date < z_date
end

#z_dateObject



11
12
13
# File 'lib/bundler/restrict/checks/date_check.rb', line 11

def z_date
  Date.parse ENV.fetch('BUNDLE_RESTRICT_Z_DATE', '2022-02-01')
end