Class: Nanite::TagUpdate

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

Overview

packet that is sent by agents to the mapper to update their tags

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

Constructor Details

#initialize(identity, new_tags, obsolete_tags, size = nil) ⇒ TagUpdate

Returns a new instance of TagUpdate.



415
416
417
418
419
420
# File 'lib/nanite/packets.rb', line 415

def initialize(identity, new_tags, obsolete_tags, size=nil)
  @identity      = identity
  @new_tags      = new_tags
  @obsolete_tags = obsolete_tags
  @size          = size
end

Instance Attribute Details

#identityObject

Returns the value of attribute identity.



413
414
415
# File 'lib/nanite/packets.rb', line 413

def identity
  @identity
end

#new_tagsObject

Returns the value of attribute new_tags.



413
414
415
# File 'lib/nanite/packets.rb', line 413

def new_tags
  @new_tags
end

#obsolete_tagsObject

Returns the value of attribute obsolete_tags.



413
414
415
# File 'lib/nanite/packets.rb', line 413

def obsolete_tags
  @obsolete_tags
end

Class Method Details

.json_create(o) ⇒ Object



422
423
424
425
# File 'lib/nanite/packets.rb', line 422

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

Instance Method Details

#to_sObject



427
428
429
430
431
432
# File 'lib/nanite/packets.rb', line 427

def to_s
  log_msg = "#{super} #{id_to_s(identity)}"
  log_msg += ", new tags: #{new_tags.join(', ')}" if new_tags && !new_tags.empty?
  log_msg += ", obsolete tags: #{obsolete_tags.join(', ')}" if obsolete_tags && !obsolete_tags.empty?
  log_msg
end