Class: Nanite::TagQuery
Overview
Tag query: retrieve agent ids with associated tags that match given tags
Options: from is sender identity opts Hash of options, two options are supported, at least one must be set:
:tags is an array of tags defining a query that returned agents tags must match
:agent_ids is an array of agents whose tags should be returned
Instance Attribute Summary collapse
-
#agent_ids ⇒ Object
Returns the value of attribute agent_ids.
-
#from ⇒ Object
Returns the value of attribute from.
-
#persistent ⇒ Object
Returns the value of attribute persistent.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#token ⇒ Object
Returns the value of attribute token.
Attributes inherited from Packet
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(from, opts, size = nil) ⇒ TagQuery
constructor
A new instance of TagQuery.
- #to_s(filter = nil) ⇒ Object
Methods inherited from Packet
Constructor Details
#initialize(from, opts, size = nil) ⇒ TagQuery
Returns a new instance of TagQuery.
229 230 231 232 233 234 235 236 |
# File 'lib/nanite/packets.rb', line 229 def initialize(from, opts, size=nil) @from = from @token = opts[:token] @agent_ids = opts[:agent_ids] @tags = opts[:tags] @persistent = opts[:persistent] @size = size end |
Instance Attribute Details
#agent_ids ⇒ Object
Returns the value of attribute agent_ids.
227 228 229 |
# File 'lib/nanite/packets.rb', line 227 def agent_ids @agent_ids end |
#from ⇒ Object
Returns the value of attribute from.
227 228 229 |
# File 'lib/nanite/packets.rb', line 227 def from @from end |
#persistent ⇒ Object
Returns the value of attribute persistent.
227 228 229 |
# File 'lib/nanite/packets.rb', line 227 def persistent @persistent end |
#tags ⇒ Object
Returns the value of attribute tags.
227 228 229 |
# File 'lib/nanite/packets.rb', line 227 def @tags end |
#token ⇒ Object
Returns the value of attribute token.
227 228 229 |
# File 'lib/nanite/packets.rb', line 227 def token @token end |
Class Method Details
.json_create(o) ⇒ Object
238 239 240 241 242 243 |
# File 'lib/nanite/packets.rb', line 238 def self.json_create(o) i = o['data'] new(i['from'], { :token => i['token'], :agent_ids => i['agent_ids'], :tags => i['tags'], :persistent => i['persistent'] }, o['size']) end |
Instance Method Details
#to_s(filter = nil) ⇒ Object
245 246 247 248 249 250 251 |
# File 'lib/nanite/packets.rb', line 245 def to_s(filter=nil) log_msg = "#{super} <#{token}>" log_msg += " from #{id_to_s(from)}" if filter.nil? || filter.include?(:from) log_msg += " agent_ids #{agent_ids.inspect}" log_msg += " tags: #{.inspect}" log_msg end |