Sha256: 91420371e49e998ba73611d1c76516ffcd6830c49e7deb3958e6f553d308791f
Contents?: true
Size: 949 Bytes
Versions: 5
Compression:
Stored size: 949 Bytes
Contents
module Csb class Template attr_accessor :utf8_bom, :filename, :streaming, :items, :cols def initialize(utf8_bom:, streaming:) @utf8_bom = utf8_bom @streaming = streaming @cols = Cols.new @items = [] end def build streaming ? build_enumerator : build_string end def streaming? !!streaming end private def build_string builder = Builder.new(utf8_bom: utf8_bom, items: items) builder.cols.copy!(cols) builder.build end def build_enumerator Enumerator.new do |y| begin builder = Builder.new(y, utf8_bom: utf8_bom, items: items) builder.cols.copy!(cols) builder.build rescue => error if Csb.configuration.after_streaming_error.respond_to?(:call) Csb.configuration.after_streaming_error.call(error) end raise error end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
csb-0.7.0 | lib/csb/template.rb |
csb-0.6.0 | lib/csb/template.rb |
csb-0.5.1 | lib/csb/template.rb |
csb-0.5.0 | lib/csb/template.rb |
csb-0.4.0 | lib/csb/template.rb |