Class: Semlogger::Multiplex

Inherits:
Object show all
Defined in:
lib/semlogger/multiplex.rb

Instance Method Summary collapse

Constructor Details

#initialize(*dests) ⇒ Multiplex

Returns a new instance of Multiplex.



2
# File 'lib/semlogger/multiplex.rb', line 2

def initialize( *dests)  @__dests__ = dests  end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *a, &e) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/semlogger/multiplex.rb', line 6

def method_missing( m, *a, &e)
if :'level=' == m and false
 	p multiplex: m, a: a
	puts Kernel.caller.map {|l| "\t%s" % l }
end
r = true
@__dests__.each {|d| r = d.send m, *a, &e }
if :level == m and false
	p return: r, multiplex: m, d: @__dests__.last
	puts Kernel.caller.map {|l| "\t%s" % l }
end
r
end

Instance Method Details

#close(*a, &e) ⇒ Object



5
# File 'lib/semlogger/multiplex.rb', line 5

def close( *a, &e)  @__dests__.each {|d| d.close *a, &e }  end

#write(*a, &e) ⇒ Object



4
# File 'lib/semlogger/multiplex.rb', line 4

def write( *a, &e)  @__dests__.each {|d| d.write *a, &e }  end