Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Wrapping multiple objects in ruby
# 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.