Class: RSMP::Filter
- Inherits:
-
Object
- Object
- RSMP::Filter
- Defined in:
- lib/rsmp/collect/filter.rb
Overview
Filter messages based on type, direction and component id. Used by Collectors.
Instance Method Summary collapse
-
#accept?(message) ⇒ Boolean
Check a message against our match criteria Return true if there's a match, false if not.
-
#initialize(ingoing: true, outgoing: true, type:, component: nil) ⇒ Filter
constructor
A new instance of Filter.
Constructor Details
#initialize(ingoing: true, outgoing: true, type:, component: nil) ⇒ Filter
Returns a new instance of Filter.
6 7 8 9 10 11 |
# File 'lib/rsmp/collect/filter.rb', line 6 def initialize ingoing:true, outgoing:true, type:, component:nil @ingoing = ingoing @outgoing = outgoing @type = type @component = component end |
Instance Method Details
#accept?(message) ⇒ Boolean
Check a message against our match criteria Return true if there's a match, false if not
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rsmp/collect/filter.rb', line 15 def accept? return false if .direction == :in && @ingoing == false return false if .direction == :out && @outgoing == false if @type if @type.is_a? Array return false unless @type.include? .type else return false unless .type == @type end end if @component return false if .attributes['cId'] && .attributes['cId'] != @component end true end |