Class: RequestRecorder::Repeater

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

Instance Method Summary collapse

Constructor Details

#initialize(targets) ⇒ Repeater

Returns a new instance of Repeater.



3
4
5
# File 'lib/request_recorder/repeater.rb', line 3

def initialize(targets)
  @targets = targets
end

Instance Method Details

#add(*args) ⇒ Object

Rails 3



13
14
15
16
17
18
19
20
21
# File 'lib/request_recorder/repeater.rb', line 13

def add(*args)
  @targets.each do |t|
    if t.respond_to?(:add)
      t.add(*args)
    else
      t.write("#{args[1]}\n")
    end
  end
end

#levelObject



27
28
29
# File 'lib/request_recorder/repeater.rb', line 27

def level
  @targets.detect{|t| t.respond_to?(:level) }.level
end

#level=(x) ⇒ Object



23
24
25
# File 'lib/request_recorder/repeater.rb', line 23

def level=(x)
  @targets.each{|t| t.level = x if t.respond_to?(:level=) }
end

#write(*args) ⇒ Object

Rails 2



8
9
10
# File 'lib/request_recorder/repeater.rb', line 8

def write(*args)
  @targets.each{|t| t.write(*args) }
end