Class: MergeExcel::Sheet

Inherits:
Object
  • Object
show all
Defined in:
lib/merge_excel/sheet.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source_sheet, source_sheet_idx) ⇒ Sheet

Returns a new instance of Sheet.



4
5
6
7
8
9
10
11
12
# File 'lib/merge_excel/sheet.rb', line 4

def initialize(source_sheet, source_sheet_idx)
  @source_sheet     = source_sheet
  @source_sheet_idx = source_sheet_idx
  @name             = @source_sheet.sheet_name
  @book             = @source_sheet.workbook

  @header = nil
  @data_rows = []
end

Instance Attribute Details

#bookObject (readonly)

Returns the value of attribute book.



3
4
5
# File 'lib/merge_excel/sheet.rb', line 3

def book
  @book
end

#data_rowsObject (readonly)

Returns the value of attribute data_rows.



3
4
5
# File 'lib/merge_excel/sheet.rb', line 3

def data_rows
  @data_rows
end

#headerObject (readonly)

Returns the value of attribute header.



3
4
5
# File 'lib/merge_excel/sheet.rb', line 3

def header
  @header
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/merge_excel/sheet.rb', line 3

def name
  @name
end

#sheet_idxObject (readonly)

Returns the value of attribute sheet_idx.



3
4
5
# File 'lib/merge_excel/sheet.rb', line 3

def sheet_idx
  @sheet_idx
end

#source_sheetObject (readonly)

Returns the value of attribute source_sheet.



3
4
5
# File 'lib/merge_excel/sheet.rb', line 3

def source_sheet
  @source_sheet
end

#source_sheet_idxObject (readonly)

Returns the value of attribute source_sheet_idx.



3
4
5
# File 'lib/merge_excel/sheet.rb', line 3

def source_sheet_idx
  @source_sheet_idx
end

Instance Method Details

#add_data_row(array, extra_data, book) ⇒ Object



18
19
20
# File 'lib/merge_excel/sheet.rb', line 18

def add_data_row(array, extra_data, book)
  @data_rows << DataRow.new(array || [], extra_data, book).array
end

#add_header(array, extra_data) ⇒ Object



14
15
16
# File 'lib/merge_excel/sheet.rb', line 14

def add_header(array, extra_data)
  @header = Header.new(array, extra_data)
end