Class: CoderWally::StatusCodeFromError

Inherits:
Object
  • Object
show all
Defined in:
lib/coder_wally/status_code_from_error.rb

Overview

return status code from error object

Instance Method Summary collapse

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?

Returns:

  • (Boolean)


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?

Returns:

  • (Boolean)


21
22
23
# File 'lib/coder_wally/status_code_from_error.rb', line 21

def io?
  true if @error.io
end

#status_codeObject

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?

Returns:

  • (Boolean)


26
27
28
# File 'lib/coder_wally/status_code_from_error.rb', line 26

def status_code?
  true if @error.io.status
end