Class: Creek::Sheet

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(book, name, sheetid, state, visible, rid, index) ⇒ Sheet

Returns a new instance of Sheet.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/creek/sheet.rb', line 16

def initialize(book, name, sheetid, state, visible, rid, index)
  @book    = book
  @name    = name
  @sheetid = sheetid
  @visible = visible
  @rid     = rid
  @state   = state
  @index   = index

  # An XLS file has only 256 columns, however, an XLSX or XLSM file can contain up to 16384 columns.
  # This function creates a hash with all valid XLSX column names and associated indices.
  @@excel_col_names = Hash.new
  (0...16384).each do |i|
    @@excel_col_names[col_name(i)] = i
  end
end

Instance Attribute Details

#bookObject (readonly)

Returns the value of attribute book.



7
8
9
# File 'lib/creek/sheet.rb', line 7

def book
  @book
end

#indexObject (readonly)

Returns the value of attribute index.



7
8
9
# File 'lib/creek/sheet.rb', line 7

def index
  @index
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/creek/sheet.rb', line 7

def name
  @name
end

#ridObject (readonly)

Returns the value of attribute rid.



7
8
9
# File 'lib/creek/sheet.rb', line 7

def rid
  @rid
end

#sheetidObject (readonly)

Returns the value of attribute sheetid.



7
8
9
# File 'lib/creek/sheet.rb', line 7

def sheetid
  @sheetid
end

#stateObject (readonly)

Returns the value of attribute state.



7
8
9
# File 'lib/creek/sheet.rb', line 7

def state
  @state
end

#visibleObject (readonly)

Returns the value of attribute visible.



7
8
9
# File 'lib/creek/sheet.rb', line 7

def visible
  @visible
end

Instance Method Details

#rowsObject

Provides an Enumerator that returns a hash representing each row. The key of the hash is the Cell id and the value is the value of the cell.



36
37
38
# File 'lib/creek/sheet.rb', line 36

def rows
  rows_generator
end

#rows_arrayObject



40
41
42
# File 'lib/creek/sheet.rb', line 40

def rows_array
  rows_array_generator
end

#rows_with_meta_dataObject

Provides an Enumerator that returns a hash representing each row. The hash contains meta data of the row and a ‘cells’ embended hash which contains the cell contents.



47
48
49
# File 'lib/creek/sheet.rb', line 47

def 
  rows_generator true
end