Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Wrapping multiple objects in ruby
# Multiplexer - multiple objects wrapped in one object
# written by Jared Grippe
class Multiplexer
instance_methods.each { |m| undef_method m unless m =~ /^__/ }
def initialize *objects
@__objects__ = objects
def method_missing(sym, *args, &block){|io| io.__send__(sym, *args, &block) }.first
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment