Class: CoderWally::StatusCodeFromError
- Inherits:
-
Object
- Object
- CoderWally::StatusCodeFromError
- Defined in:
- lib/coder_wally/status_code_from_error.rb
Overview
return status code from error object
Instance Method Summary collapse
-
#error? ⇒ Boolean
Is there an error object?.
-
#initialize(error) ⇒ StatusCodeFromError
constructor
Initialise object.
-
#io? ⇒ Boolean
Is there an io object?.
-
#status_code ⇒ Object
Get the status code.
-
#status_code? ⇒ Boolean
Is there a status?.
Constructor Details
#initialize(error) ⇒ StatusCodeFromError
Initialise object
6 7 8 |
# File 'lib/coder_wally/status_code_from_error.rb', line 6 def initialize(error) @error = error end |
Instance Method Details
#error? ⇒ Boolean
Is there an error object?
16 17 18 |
# File 'lib/coder_wally/status_code_from_error.rb', line 16 def error? true if @error end |
#io? ⇒ Boolean
Is there an io object?
21 22 23 |
# File 'lib/coder_wally/status_code_from_error.rb', line 21 def io? true if @error.io end |
#status_code ⇒ Object
Get the status code
11 12 13 |
# File 'lib/coder_wally/status_code_from_error.rb', line 11 def status_code @error.io.status[0] if error? && io? && status_code? end |
#status_code? ⇒ Boolean
Is there a status?
26 27 28 |
# File 'lib/coder_wally/status_code_from_error.rb', line 26 def status_code? true if @error.io.status end |