Class: Portable::Modeling::Sheet

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/portable/modeling/sheet.rb

Overview

Abstract concept modeling for the notion of a “sheet” in a “document”. This means different things given the writer. For example, all writers should support multiple sheets but there is no internal representation of a “sheet” within a CSV, so each sheet will emit one file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data_source_name: '', data_table: nil, footer_rows: [], header_rows: [], name: '') ⇒ Sheet

Returns a new instance of Sheet.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/portable/modeling/sheet.rb', line 33

def initialize(
  data_source_name: '',
  data_table: nil,
  footer_rows: [],
  header_rows: [],
  name: ''
)
  @data_source_name = decide_data_source_name(data_source_name, name)
  @name             = name.to_s
  @data_table       = DataTable.make(data_table, nullable: false)
  @footer_rows      = footer_rows || []
  @header_rows      = header_rows || []

  freeze
end

Instance Attribute Details

#data_source_nameObject (readonly)

Returns the value of attribute data_source_name.



27
28
29
# File 'lib/portable/modeling/sheet.rb', line 27

def data_source_name
  @data_source_name
end

#data_tableObject (readonly)

Returns the value of attribute data_table.



27
28
29
# File 'lib/portable/modeling/sheet.rb', line 27

def data_table
  @data_table
end

Returns the value of attribute footer_rows.



27
28
29
# File 'lib/portable/modeling/sheet.rb', line 27

def footer_rows
  @footer_rows
end

#header_rowsObject (readonly)

Returns the value of attribute header_rows.



27
28
29
# File 'lib/portable/modeling/sheet.rb', line 27

def header_rows
  @header_rows
end

#nameObject (readonly)

Returns the value of attribute name.



27
28
29
# File 'lib/portable/modeling/sheet.rb', line 27

def name
  @name
end