Class: Threatinator::FileBasedOutput

Inherits:
Output
  • Object
show all
Defined in:
lib/threatinator/output.rb

Defined Under Namespace

Classes: Config

Instance Method Summary collapse

Methods inherited from Output

#handle_event

Constructor Details

#initialize(config) ⇒ FileBasedOutput

Returns a new instance of FileBasedOutput.



28
29
30
31
32
33
34
35
36
37
# File 'lib/threatinator/output.rb', line 28

def initialize(config)
  super(config)
  if io = config.io
    @output_io = io
  elsif filename = config.filename
    @output_io = File.open(filename, 'w:UTF-8')
  else
    @output_io = $stdout.dup
  end
end

Instance Method Details

#finishObject



39
40
41
# File 'lib/threatinator/output.rb', line 39

def finish
  @output_io.close
end