class Csb::Builder

Constants

UTF8_BOM

Attributes

cols[R]
items[RW]
output[R]
utf8_bom[R]

Public Class Methods

new(output = '', items: [], utf8_bom: false) click to toggle source
# File lib/csb/builder.rb, line 11
def initialize(output = '', items: [], utf8_bom: false)
  @output = output
  @utf8_bom = utf8_bom
  @cols = Cols.new
  @items = items
end

Public Instance Methods

build() click to toggle source
# File lib/csb/builder.rb, line 18
def build
  output << UTF8_BOM if utf8_bom
  output << CSV.generate_line(cols.headers)
  items.each do |item|
    output << CSV.generate_line(cols.values_by_item(item))
  rescue => error
    break if Csb.configuration.ignore_class_names.include?(error.class.name)

    raise error
  end
  output
end