Class: RgGen::SpreadsheetLoader::Spreadsheet::Book

Inherits:
Object
  • Object
show all
Defined in:
lib/rggen/spreadsheet_loader/spreadsheet/book.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Book

Returns a new instance of Book.



7
8
9
10
11
# File 'lib/rggen/spreadsheet_loader/spreadsheet/book.rb', line 7

def initialize(file)
  @file = file
  @sheets = []
  block_given? && yield(self)
end

Instance Attribute Details

#fileObject (readonly)

Returns the value of attribute file.



13
14
15
# File 'lib/rggen/spreadsheet_loader/spreadsheet/book.rb', line 13

def file
  @file
end

#sheetsObject (readonly)

Returns the value of attribute sheets.



14
15
16
# File 'lib/rggen/spreadsheet_loader/spreadsheet/book.rb', line 14

def sheets
  @sheets
end

Instance Method Details

#add_sheet(sheet_name, table) ⇒ Object



16
17
18
19
20
# File 'lib/rggen/spreadsheet_loader/spreadsheet/book.rb', line 16

def add_sheet(sheet_name, table)
  sheet = Sheet.new(self, sheet_name)
  sheet.from_table(table)
  sheets << sheet
end