Class: DVLA::Herodotus::MultiWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/dvla/herodotus/multi_writer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*targets) ⇒ MultiWriter

Returns a new instance of MultiWriter.



6
7
8
# File 'lib/dvla/herodotus/multi_writer.rb', line 6

def initialize(*targets)
  @targets = *targets
end

Instance Attribute Details

#targetsObject (readonly)

Returns the value of attribute targets.



4
5
6
# File 'lib/dvla/herodotus/multi_writer.rb', line 4

def targets
  @targets
end

Instance Method Details

#closeObject



14
15
16
17
18
# File 'lib/dvla/herodotus/multi_writer.rb', line 14

def close
  @targets.each do |t|
    t.close unless t.eql? $stdout
  end
end

#write(*args) ⇒ Object



10
11
12
# File 'lib/dvla/herodotus/multi_writer.rb', line 10

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