Class: Nanite::Ping

Inherits:
Packet show all
Defined in:
lib/nanite/packets.rb

Overview

heartbeat packet

identity is sender’s identity status is sender’s status (see Register packet documentation)

Instance Attribute Summary collapse

Attributes inherited from Packet

#size

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Packet

#id_to_s, #to_json, #wrap

Constructor Details

#initialize(identity, status, size = nil) ⇒ Ping

Returns a new instance of Ping.



337
338
339
340
341
# File 'lib/nanite/packets.rb', line 337

def initialize(identity, status, size=nil)
  @status   = status
  @identity = identity
  @size     = size
end

Instance Attribute Details

#identityObject

Returns the value of attribute identity.



335
336
337
# File 'lib/nanite/packets.rb', line 335

def identity
  @identity
end

#statusObject

Returns the value of attribute status.



335
336
337
# File 'lib/nanite/packets.rb', line 335

def status
  @status
end

Class Method Details

.json_create(o) ⇒ Object



343
344
345
346
# File 'lib/nanite/packets.rb', line 343

def self.json_create(o)
  i = o['data']
  new(i['identity'], i['status'], o['size'])
end

Instance Method Details

#to_sObject



348
349
350
# File 'lib/nanite/packets.rb', line 348

def to_s
  "#{super} #{id_to_s(identity)} status #{status}"
end