Class: Csb::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/csb/template.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(streaming:) ⇒ Template

Returns a new instance of Template.



5
6
7
8
9
# File 'lib/csb/template.rb', line 5

def initialize(streaming:)
  @streaming = streaming
  @cols = Cols.new
  @items = []
end

Instance Attribute Details

#colsObject

Returns the value of attribute cols.



3
4
5
# File 'lib/csb/template.rb', line 3

def cols
  @cols
end

#csv_optionsObject

Returns the value of attribute csv_options.



3
4
5
# File 'lib/csb/template.rb', line 3

def csv_options
  @csv_options
end

#filenameObject

Returns the value of attribute filename.



3
4
5
# File 'lib/csb/template.rb', line 3

def filename
  @filename
end

#itemsObject

Returns the value of attribute items.



3
4
5
# File 'lib/csb/template.rb', line 3

def items
  @items
end

#streamingObject

Returns the value of attribute streaming.



3
4
5
# File 'lib/csb/template.rb', line 3

def streaming
  @streaming
end

#utf8_bomObject

Returns the value of attribute utf8_bom.



3
4
5
# File 'lib/csb/template.rb', line 3

def utf8_bom
  @utf8_bom
end

Instance Method Details

#buildObject



11
12
13
# File 'lib/csb/template.rb', line 11

def build
  streaming ? build_enumerator : build_string
end

#streaming?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/csb/template.rb', line 15

def streaming?
  !!streaming
end