Module: Synapse::Wiring::MessageWiring::ClassMethods

Defined in:
lib/synapse/wiring/message_wiring.rb

Instance Method Summary collapse

Instance Method Details

#wire(type, *args, &block) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/synapse/wiring/message_wiring.rb', line 17

def wire(type, *args, &block)
  options = args.extract_options!

  to = options.delete :to
  unless to
    unless block
      raise ArgumentError, 'Expected block or option :to'
    end

    to = block
  end

  wire = Wire.new type, options, to

  self.wire_registry.register wire
end