class Portable::Modeling::Sheet
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.
Attributes
data_source_name[R]
data_table[R]
header_rows[R]
name[R]
Public Class Methods
new( data_source_name: '', data_table: nil, footer_rows: [], header_rows: [], name: '' )
click to toggle source
# 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
Private Instance Methods
decide_data_source_name(data_source_name, sheet_name)
click to toggle source
Use exact name if possible, if not then use the sheet name or else use the “default” one (noted by a blank name).
# File lib/portable/modeling/sheet.rb, line 53 def decide_data_source_name(data_source_name, sheet_name) if !data_source_name.to_s.empty? data_source_name.to_s elsif !sheet_name.to_s.empty? sheet_name.to_s else '' end end