Class: MultiIO

Inherits:
Object
  • Object
show all
Defined in:
lib/multiio.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*targets) ⇒ MultiIO

Returns a new instance of MultiIO.



15
16
17
18
# File 'lib/multiio.rb', line 15

def initialize(*targets)
  @targets = targets
  MultiIO.delegate_all
end

Class Method Details

.delegate_allObject



5
6
7
8
9
10
11
12
13
# File 'lib/multiio.rb', line 5

def self.delegate_all
  IO.methods.each do |m|
    define_method(m) do |*args|
      ret = nil
      @targets.each { |t| ret = t.send(m, *args) }
      ret
    end
  end
end