Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Wrapping multiple objects in ruby

View multiplexer.rb
1 2 3 4 5 6 7 8 9 10 11
# Multiplexer - multiple objects wrapped in one object
# written by Jared Grippe jared@change.org
class Multiplexer
instance_methods.each { |m| undef_method m unless m =~ /^__/ }
def initialize *objects
@__objects__ = objects
end
def method_missing(sym, *args, &block)
@__objects__.map{|io| io.__send__(sym, *args, &block) }.first
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.