Class: Workbook::Sheet

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

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Workbook::Sheet) initialize(table = Workbook::Table.new([], self), book = nil, options = {})

Initialize a new sheet

Parameters:

  • table (Workbook::Table, Array<Array>) (defaults to: Workbook::Table.new([], self))

    The first table of this sheet

  • book (Workbook::Book) (defaults to: nil)

    The book this sheet belongs to

  • options (Hash) (defaults to: {})

    are forwarded to Workbook::Table.new



12
# File 'lib/workbook/sheet.rb', line 12

def initialize table=Workbook::Table.new([], self), book=nil, options={}

Instance Attribute Details

- (Workbook::Book) book

Returns the book this sheet belongs to

Returns:



4
5
6
# File 'lib/workbook/sheet.rb', line 4

def book
  @book
end

Instance Method Details

- (Boolean) has_contents?

Returns true if the first table of this sheet contains anything

Returns:

  • (Boolean)


25
26
27
# File 'lib/workbook/sheet.rb', line 25

def has_contents?
  table.has_contents?
end

- (Workbook::Table) table

Returns the first table of this sheet

Returns:



32
33
34
# File 'lib/workbook/sheet.rb', line 32

def table
  first
end