Class: Flappy::MultiIO::MultiDelegator

Inherits:
Object
  • Object
show all
Defined in:
lib/flappy/util/multi_io.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*targets) ⇒ MultiDelegator

Returns a new instance of MultiDelegator.



7
8
9
# File 'lib/flappy/util/multi_io.rb', line 7

def initialize(*targets)
  @targets = targets
end

Class Method Details

.delegate(*methods) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/flappy/util/multi_io.rb', line 11

def self.delegate(*methods)
  methods.each do |m|
    define_method(m) do |*args|
      @targets.map { |t| t.send(m, *args) }
    end
  end
  self
end