Class: Validator::StatusHelpers::S0033Matcher
- Inherits:
-
RSMP::StatusMatcher
- Object
- RSMP::StatusMatcher
- Validator::StatusHelpers::S0033Matcher
- Defined in:
- spec/support/signal_priority_request_helper.rb
Overview
Match a specific status response or update
Instance Attribute Summary collapse
-
#state ⇒ Object
Returns the value of attribute state.
Instance Method Summary collapse
-
#find_request_state(list) ⇒ Object
look through a status message to find state updates for a specific priority request.
-
#initialize(want, request_id:, state: nil) ⇒ S0033Matcher
constructor
A new instance of S0033Matcher.
-
#match?(item) ⇒ Boolean
Match a status value against a matcher.
Constructor Details
#initialize(want, request_id:, state: nil) ⇒ S0033Matcher
Returns a new instance of S0033Matcher.
7 8 9 10 11 12 |
# File 'spec/support/signal_priority_request_helper.rb', line 7 def initialize want, request_id:, state: nil super want @request_id = request_id @state = state @latest_state = nil end |
Instance Attribute Details
#state ⇒ Object
Returns the value of attribute state.
6 7 8 |
# File 'spec/support/signal_priority_request_helper.rb', line 6 def state @state end |
Instance Method Details
#find_request_state(list) ⇒ Object
look through a status message to find state updates for a specific priority request
32 33 34 35 |
# File 'spec/support/signal_priority_request_helper.rb', line 32 def find_request_state list priority = list.find { |prio| prio['r'] == @request_id } priority['s'] if priority end |
#match?(item) ⇒ Boolean
Match a status value against a matcher
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'spec/support/signal_priority_request_helper.rb', line 15 def match? item super_matched = super(item) if super_matched == true state = find_request_state item['s'] if state == @state.to_s && state != @latest_state @latest_state = state true else false end else super_matched end end |