Class: BerkeleyLibrary::TIND::Export::CSVExporter

Inherits:
Exporter
  • Object
show all
Defined in:
lib/berkeley_library/tind/export/csv_exporter.rb

Overview

Exporter for CSV (comma-separated value) text

Instance Attribute Summary

Attributes inherited from Exporter

#collection, #exportable_only

Instance Method Summary collapse

Methods inherited from Exporter

#any_results?, #export_table, #initialize, #respond_to?

Constructor Details

This class inherits a constructor from BerkeleyLibrary::TIND::Export::Exporter

Instance Method Details

#exportString #export(out) ⇒ Object #export(path) ⇒ Object

Exports ExportBase#collection as CSV

Overloads:

  • #exportString

    Exports to a new string.

    Returns:

    • (String)

      the CSV string

  • #export(out) ⇒ Object

    Exports to the specified output stream. @return[void]

    Parameters:

    • out (IO)

      the output stream

  • #export(path) ⇒ Object

    Exports to the specified file. @return[void]

    Parameters:

    • path (String, Pathname)

      the path to the output file



21
22
23
24
# File 'lib/berkeley_library/tind/export/csv_exporter.rb', line 21

def export(out = nil)
  # noinspection RubyYardReturnMatch
  export_table.tap { logger.info('Writing CSV') }.to_csv(out)
end