Module: Synapse::Wiring::MessageWiring::ClassMethods
- Defined in:
- lib/synapse/wiring/message_wiring.rb
Instance Method Summary collapse
-
#wire(type, *args, &block) ⇒ undefined
Wires a message handler to messages with payload of the given type.
Instance Method Details
#wire(type, *args, &block) ⇒ undefined
Wires a message handler to messages with payload of the given type
Certain components that use message handling have different options that can be set on wires, like wiring processes.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/synapse/wiring/message_wiring.rb', line 48 def wire(type, *args, &block) = args. to = .delete :to unless to unless block raise ArgumentError, 'Expected block or option :to' end to = block end wire = Wire.new type, , to self.wire_registry.register wire end |