Sha256: c4094bd33a6f7c523479a2eae2facdf9a560f099a7363585f44d1a7794cddce1

Contents?: true

Size: 582 Bytes

Versions: 4

Compression:

Stored size: 582 Bytes

Contents

# All code in the gem is namespaced under this module.
module CoderWally
  # return status code from error object
  class StatusCodeFromError
    # Initialise object
    def initialize(error)
      @error = error
    end

    # Get the status code
    def status_code
      @error.io.status[0] if error? && io? && status_code?
    end

    # Is there an error object?
    def error?
      true if @error
    end

    # Is there an io object?
    def io?
      true if @error.io
    end

    # Is there a status?
    def status_code?
      true if @error.io.status
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
coder_wally-1.0.2 lib/coder_wally/status_code_from_error.rb
coder_wally-1.0.1 lib/coder_wally/status_code_from_error.rb
coder_wally-1.0.0 lib/coder_wally/status_code_from_error.rb
coder_wally-0.1.2 lib/coder_wally/status_code_from_error.rb