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

#matchers

Attributes inherited from Collector

#initiator, #m_id, #messages

Attributes included from Logging

#archive, #logger

Instance Method Summary collapse

Methods inherited from StateCollector

#add_command_result, #add_command_want_to_hash, #add_status_result, #add_status_want_to_hash, #build_collection, #describe, #describe_matcher, #describe_progress, #done?, #handle_match_result, #keep, #log_complete, #log_match_result, #matcher_got_hash, #matcher_result, #matcher_status, #matcher_want_hash, #messages, #perform_match?, #progress, #progress_hash, #reached, #summary

Methods inherited from Collector

#acceptable?, #active?, #build_collection, #cancel, #collect, #collect!, #complete, #crash, #describe, #done?, #fail, #incomplete, #inspect, #keep, #make_title, #perform_match?, #receive, #receive_connection_ended, #receive_event, #receive_invalid_message, #reject_not_ack?, #reset, #start, #stop, #wait, #wait!

Methods included from Logging

#author, #initialize_logging, #log

Methods included from RSMP::Collector::Reporting

#describe_matcher, #describe_num_and_type, #describe_progress, #describe_types, #identifier

Methods included from Receiver

#accept_message?, #handle_message, #initialize_receiver, #inspect, #receive, #receive_event, #reject_message?, #start_receiving, #stop_receiving

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(
    filter: RSMP::Filter.new(ingoing: true, outgoing: false, type: 'CommandResponse'),
    title: 'command response'
  ))
end

Instance Method Details

#build_matcher(want) ⇒ Object



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

def build_matcher(want)
  CommandMatcher.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