Class: Bundler::Restrict::Checks::DateCheck
- Inherits:
-
Object
- Object
- Bundler::Restrict::Checks::DateCheck
- Defined in:
- lib/bundler/restrict/checks/date_check.rb
Instance Method Summary collapse
- #error ⇒ Object
-
#initialize(gem_version) ⇒ DateCheck
constructor
A new instance of DateCheck.
- #valid? ⇒ Boolean
- #z_date ⇒ Object
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
#error ⇒ Object
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
15 16 17 |
# File 'lib/bundler/restrict/checks/date_check.rb', line 15 def valid? @gem_version.release_date < z_date end |
#z_date ⇒ Object
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 |