Sha256: f7cb0046cd59113baa8cb9d4767db2a1effbc26be6a39b871e8959e2d21cd777

Contents?: true

Size: 879 Bytes

Versions: 10

Compression:

Stored size: 879 Bytes

Contents

require 'csv'
require 'berkeley_library/tind/export/exporter'

module BerkeleyLibrary
  module TIND
    module Export
      # Exporter for CSV (comma-separated value) text
      class CSVExporter < Exporter
        # Exports {ExportBase#collection} as CSV
        # @overload export
        #   Exports to a new string.
        #   @return [String] the CSV string
        # @overload export(out)
        #   Exports to the specified output stream.
        #   @param out [IO] the output stream
        #   @return[void]
        # @overload export(path)
        #   Exports to the specified file.
        #   @param path [String, Pathname] the path to the output file
        #   @return[void]
        def export(out = nil)
          # noinspection RubyYardReturnMatch
          export_table.tap { logger.info('Writing CSV') }.to_csv(out)
        end

      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
berkeley_library-tind-0.7.2 lib/berkeley_library/tind/export/csv_exporter.rb
berkeley_library-tind-0.7.1 lib/berkeley_library/tind/export/csv_exporter.rb
berkeley_library-tind-0.7.0 lib/berkeley_library/tind/export/csv_exporter.rb
berkeley_library-tind-0.6.0 lib/berkeley_library/tind/export/csv_exporter.rb
berkeley_library-tind-0.5.1 lib/berkeley_library/tind/export/csv_exporter.rb
berkeley_library-tind-0.5.0 lib/berkeley_library/tind/export/csv_exporter.rb
berkeley_library-tind-0.4.3 lib/berkeley_library/tind/export/csv_exporter.rb
berkeley_library-tind-0.4.2 lib/berkeley_library/tind/export/csv_exporter.rb
berkeley_library-tind-0.4.1 lib/berkeley_library/tind/export/csv_exporter.rb
berkeley_library-tind-0.4.0 lib/berkeley_library/tind/export/csv_exporter.rb