Sha256: 3daccb8f4f781900e44662063aae0ef988e3ec9d8d686f8f54491601e4b29b7b
Contents?: true
Size: 720 Bytes
Versions: 6
Compression:
Stored size: 720 Bytes
Contents
# Container to allow writes to multiple devices # Code originally from: # http://stackoverflow.com/a/6410202 module LogStashLogger module Device class MultiDelegator < Base attr_reader :devices def initialize(opts) @io = self @devices = create_devices(opts[:outputs]) self.class.delegate(:write, :close, :flush) end private def create_devices(opts) opts.map do |device_opts| Device.new(device_opts) end end def self.delegate(*methods) methods.each do |m| define_method(m) do |*args| @devices.each { |device| device.send(m, *args) } end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems