Class: OpenTrace::Client::UnixSocketResponse

Inherits:
Struct
  • Object
show all
Defined in:
lib/opentrace/client.rb

Overview

Adapts a numeric status code from Unix socket into Net::HTTP response duck type

Instance Method Summary collapse

Instance Method Details

#is_a?(klass) ⇒ Boolean

Returns:

  • (Boolean)


545
546
547
548
549
550
551
552
553
554
# File 'lib/opentrace/client.rb', line 545

def is_a?(klass)
  c = code.to_i
  case klass.name
  when "Net::HTTPSuccess"          then c >= 200 && c < 300
  when "Net::HTTPTooManyRequests"  then c == 429
  when "Net::HTTPUnauthorized"     then c == 401
  when "Net::HTTPServerError"      then c >= 500 && c < 600
  else super
  end
end