Multiplexing Delegator plugin
Plugin details
Documentation
Install the plugin:
ruby script/plugin install http://glomp.rubyforge.org/svn/plugins/multiplexing_delegator/
The delegator works by calling the same method across multiple methods or accessors for a given object instance and aggregating the results.
Example
class Foo attr_accessor :baz, :bum multiplex :bar, :on => [:baz, :bum] end foo = Foo.new foo.baz = 1 foo.bum = ['boo'] foo.bar.map => [1, 'boo']
You can also proxy method calls to each of the delegated items and results will be aggregated.
Example
class Goo attr_accessor :car def initialize(car) @car = car; end end foo = Foo.new foo.baz = Goo.new('hello') foo.bum = Goo.new('world') foo.bar.car => ['hello, 'world']
Further Documentation
There is currently no advanced documentation for this plugin.
New documentationEdit plugin | (0 older versions) | Last edited by: Guest, 10 months ago

