Class: Logging::MultiDelegator

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

Overview

Generic delegator class

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*targets) ⇒ MultiDelegator

Returns a new instance of MultiDelegator


7
8
9
# File 'lib/sony_camera_remote_api/logging.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/sony_camera_remote_api/logging.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