Class: Subscriber::Client::ErrorResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/nchan_tools/pubsub.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, msg, bundle = nil, what = nil, failword = nil) ⇒ ErrorResponse

Returns a new instance of ErrorResponse.



257
258
259
260
261
262
263
264
265
# File 'lib/nchan_tools/pubsub.rb', line 257

def initialize(code, msg, bundle=nil, what=nil, failword=nil)
  self.code = code
  self.msg = msg
  self.bundle = bundle
  self.connected = bundle.connected? if bundle
  
  @what = what || ["handshake", "connection"]
  @failword = failword || " failed"
end

Instance Attribute Details

#bundleObject

Returns the value of attribute bundle.



256
257
258
# File 'lib/nchan_tools/pubsub.rb', line 256

def bundle
  @bundle
end

#callerObject

Returns the value of attribute caller.



256
257
258
# File 'lib/nchan_tools/pubsub.rb', line 256

def caller
  @caller
end

#codeObject

Returns the value of attribute code.



256
257
258
# File 'lib/nchan_tools/pubsub.rb', line 256

def code
  @code
end

#connectedObject

Returns the value of attribute connected.



256
257
258
# File 'lib/nchan_tools/pubsub.rb', line 256

def connected
  @connected
end

#msgObject

Returns the value of attribute msg.



256
257
258
# File 'lib/nchan_tools/pubsub.rb', line 256

def msg
  @msg
end

Instance Method Details

#to_sObject



267
268
269
# File 'lib/nchan_tools/pubsub.rb', line 267

def to_s
  "#{(caller.class.name.split('::').last || self.class.name.split('::')[-2])} #{connected ? @what.last : @what.first}#{@failword}: #{msg} (code #{code})"
end