A proxy that wraps an array of other objects. Whenever a message is received by this proxy, it delegates the call to the objects in the array.
Methods
Public Class methods
Creates a new Target object that acts as a proxy for the given list of delegates.
[ show source ]
# File lib/needle/extras/multicast.rb, line 12 12: def initialize( *delegates ) 13: @delegates = delegates 14: end
Public Instance methods
Forwards the method to each object in the array. It does no checking to ensure that the receiver can understand the message before sending it. This will return an array of the results of calling each of the other messages.
[ show source ]
# File lib/needle/extras/multicast.rb, line 20 20: def method_missing( sym, *args, &block ) 21: @delegates.inject( [] ) do |a,d| 22: a << d.__send__( sym, *args, &block ) 23: end 24: end