Sha256: 3b031cf77056d2db194cb02093059f0d1c585c932522254fae02b9ab16e8d352
Contents?: true
Size: 824 Bytes
Versions: 1
Compression:
Stored size: 824 Bytes
Contents
The multicast service is parameterized. Just send it a list of objects (i.e., other services) that you want multicasted to, and it will return a new multicaster object. <pre> reg = Needle::Registry.define do |b| b.require 'needle/extras/multicast', 'Needle::Extras::Multicast' b.foo { "hello" } b.bar { [ 1, 2, 3 ] } b.baz { "test" } b.multicaster { |c,| c.multicast c.foo, c.bar, c.baz } end </pre> Once you've registered your service, you can send messages to the observing services by sending messages to the multicaster: <pre> m = reg.multicaster p m.length #-> [ 5, 3, 4 ] </pre> The multicaster will return an array of the return values of all of the observing services. Thus, in the above example, an array of the lengths of each of the @foo@, @bar@, and @baz@ services is returned.
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
needle-extras-1.0.0 | doc/manual/parts/multicast_usage.txt |