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)


557
558
559
560
561
562
563
564
565
566
# File 'lib/opentrace/client.rb', line 557

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