Class: Rigrate::MutiOutput

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

Overview

used to output logger to mutli place

Instance Method Summary collapse

Constructor Details

#initialize(file, prompt) ⇒ MutiOutput

Returns a new instance of MutiOutput.



17
18
19
20
21
# File 'lib/rigrate.rb', line 17

def initialize(file, prompt)
  @target = []
  @target << file
  @target << STDOUT if prompt
end

Instance Method Details

#closeObject



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

def close
  @target.each(&:close)
end

#write(*args) ⇒ Object



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

def write(*args)
  @target.each { |dest| dest.write(*args) }
end