Class: Ronin::Core::OutputFormats::CSV

Inherits:
OutputFile show all
Defined in:
lib/ronin/core/output_formats/csv.rb

Overview

Represents a CSV (.csv) output format.

Since:

  • 0.2.0

Instance Attribute Summary

Attributes inherited from OutputFile

#io

Instance Method Summary collapse

Methods inherited from OutputFile

#close, #initialize, open

Constructor Details

This class inherits a constructor from Ronin::Core::OutputFormats::OutputFile

Instance Method Details

#<<(value) ⇒ Object

Appends a value to the CSV stream.

Parameters:

  • value (#to_csv)

    The value to append.

Raises:

  • (NotImplementedError)

    The given output value does not define a to_csv method.

Since:

  • 0.2.0



44
45
46
47
48
49
50
51
52
53
# File 'lib/ronin/core/output_formats/csv.rb', line 44

def <<(value)
  unless value.respond_to?(:to_csv)
    raise(NotImplementedError,"output value must define a #to_csv method: #{value.inspect}")
  end

  @io.write(value.to_csv)
  @io.flush

  return self
end