Class: DeprecationAnalysis
- Inherits:
-
Object
- Object
- DeprecationAnalysis
- Defined in:
- lib/stitches/spec/show_deprecation.rb
Instance Attribute Summary collapse
-
#expected_sunset_value ⇒ Object
readonly
Returns the value of attribute expected_sunset_value.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#sunset_value ⇒ Object
readonly
Returns the value of attribute sunset_value.
Instance Method Summary collapse
- #expecting_sunset? ⇒ Boolean
- #gone? ⇒ Boolean
-
#initialize(rspec_api_documentation_context, gone_on) ⇒ DeprecationAnalysis
constructor
A new instance of DeprecationAnalysis.
- #sunset_header_match? ⇒ Boolean
- #sunset_header_set? ⇒ Boolean
Constructor Details
#initialize(rspec_api_documentation_context, gone_on) ⇒ DeprecationAnalysis
Returns a new instance of DeprecationAnalysis.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/stitches/spec/show_deprecation.rb', line 3 def initialize(rspec_api_documentation_context, gone_on) gone_on_date = Date.parse(gone_on) if gone_on_date > Date.today @expecting_sunset = true @expected_sunset_value = gone_on_date.in_time_zone("GMT").midnight.strftime("%a, %e %b %Y %H:%M:%S %Z") @sunset_header_set = rspec_api_documentation_context.response_headers["Sunset"].present? @sunset_value = rspec_api_documentation_context.response_headers["Sunset"] @sunset_header_match = @expected_sunset_value == @sunset_value else @expecting_gone = true @status = rspec_api_documentation_context.status @gone = @status == 410 end end |
Instance Attribute Details
#expected_sunset_value ⇒ Object (readonly)
Returns the value of attribute expected_sunset_value.
2 3 4 |
# File 'lib/stitches/spec/show_deprecation.rb', line 2 def expected_sunset_value @expected_sunset_value end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
2 3 4 |
# File 'lib/stitches/spec/show_deprecation.rb', line 2 def status @status end |
#sunset_value ⇒ Object (readonly)
Returns the value of attribute sunset_value.
2 3 4 |
# File 'lib/stitches/spec/show_deprecation.rb', line 2 def sunset_value @sunset_value end |
Instance Method Details
#expecting_sunset? ⇒ Boolean
18 |
# File 'lib/stitches/spec/show_deprecation.rb', line 18 def expecting_sunset?; !!@expecting_sunset; end |
#gone? ⇒ Boolean
21 |
# File 'lib/stitches/spec/show_deprecation.rb', line 21 def gone?; !!@gone; end |
#sunset_header_match? ⇒ Boolean
20 |
# File 'lib/stitches/spec/show_deprecation.rb', line 20 def sunset_header_match?; !!@sunset_header_match; end |
#sunset_header_set? ⇒ Boolean
19 |
# File 'lib/stitches/spec/show_deprecation.rb', line 19 def sunset_header_set?; !!@sunset_header_set; end |