Class: RSMP::CommandResponseCollector

Inherits:
StateCollector show all
Defined in:
lib/rsmp/collect/command_response_collector.rb

Overview

Class for waiting for specific command responses

Instance Attribute Summary

Attributes inherited from StateCollector

#queries

Attributes inherited from Collector

#condition, #error, #messages, #status, #task

Instance Method Summary collapse

Methods inherited from StateCollector

#describe, #describe_progress, #describe_query, #done?, #keep, #messages, #perform_match, #progress, #query_result, #query_status, #reached, #summary

Methods inherited from Collector

#cancel, #cancelled?, #collect, #collect!, #collecting?, #complete, #describe, #describe_num_and_type, #describe_progress, #describe_query, #do_stop, #done?, #identifier, #incomplete, #ingoing?, #inspect, #keep, #log_complete, #log_incomplete, #log_start, #notify, #notify_disconnect, #notify_error, #notify_schema_error, #ok!, #ok?, #outgoing?, #perform_match, #ready?, #reject_not_ack, #reset, #start, #timeout?, #type_match?, #use_task, #wait, #wait!

Methods inherited from Listener

#change_notifier, #notify, #notify_error

Methods included from Inspect

#inspect, #inspector

Constructor Details

#initialize(proxy, want, options = {}) ⇒ CommandResponseCollector

Returns a new instance of CommandResponseCollector.



4
5
6
7
8
9
# File 'lib/rsmp/collect/command_response_collector.rb', line 4

def initialize proxy, want, options={}
  super proxy, want, options.merge(
    type: 'CommandResponse',
    title:'command response'
  )
end

Instance Method Details

#build_query(want) ⇒ Object



11
12
13
# File 'lib/rsmp/collect/command_response_collector.rb', line 11

def build_query want
  CommandQuery.new want
end

#get_items(message) ⇒ Object

Get items, in our case the return values



16
17
18
# File 'lib/rsmp/collect/command_response_collector.rb', line 16

def get_items message
  message.attributes['rvs'] || []
end