Class: Rooibos::Router::Predicate::Events

Inherits:
Object
  • Object
show all
Defined in:
lib/rooibos/router/predicate.rb

Overview

Matches key events by symbol.

Instance Method Summary collapse

Constructor Details

#initialize(keys:) ⇒ Events

Returns a new instance of Events.



15
16
17
# File 'lib/rooibos/router/predicate.rb', line 15

def initialize(keys:)
  super(keys: Array(keys))
end

Instance Method Details

#arityObject



19
# File 'lib/rooibos/router/predicate.rb', line 19

def arity = 2

#call(message, _model) ⇒ Object



21
22
23
# File 'lib/rooibos/router/predicate.rb', line 21

def call(message, _model)
  message.respond_to?(:to_sym) && keys.include?(message.to_sym)
end