class OutputMode::Outputs::Delimited

Public Instance Methods

config() click to toggle source

@return [Hash] additional options to CSV.new @see ruby-doc.org/stdlib-2.6.1/libdoc/csv/rdoc/CSV.html

Calls superclass method
# File lib/output_mode/outputs/delimited.rb, line 34
def config; super; end
render(*data) click to toggle source

Implements the render method using CSV

@see OutputMode::Output#render @see CSV

# File lib/output_mode/outputs/delimited.rb, line 40
def render(*data)
  io = StringIO.new
  csv = CSV.new(io, **config)
  data.each do |datum|
    csv << generate(datum).map do |value|
      next nil if value.nil?
      value.to_s.dump[1...-1]
    end
  end
  io.tap(&:rewind).read
end