Class: Creek::Sheet
- Inherits:
-
Object
- Object
- Creek::Sheet
- Defined in:
- lib/creek/sheet.rb
Instance Attribute Summary collapse
-
#book ⇒ Object
readonly
Returns the value of attribute book.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#rid ⇒ Object
readonly
Returns the value of attribute rid.
-
#sheetid ⇒ Object
readonly
Returns the value of attribute sheetid.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#visible ⇒ Object
readonly
Returns the value of attribute visible.
Instance Method Summary collapse
-
#initialize(book, name, sheetid, state, visible, rid, index) ⇒ Sheet
constructor
A new instance of Sheet.
-
#rows ⇒ Object
Provides an Enumerator that returns a hash representing each row.
- #rows_array ⇒ Object
-
#rows_with_meta_data ⇒ Object
Provides an Enumerator that returns a hash representing each row.
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
#book ⇒ Object (readonly)
Returns the value of attribute book.
7 8 9 |
# File 'lib/creek/sheet.rb', line 7 def book @book end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
7 8 9 |
# File 'lib/creek/sheet.rb', line 7 def index @index end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/creek/sheet.rb', line 7 def name @name end |
#rid ⇒ Object (readonly)
Returns the value of attribute rid.
7 8 9 |
# File 'lib/creek/sheet.rb', line 7 def rid @rid end |
#sheetid ⇒ Object (readonly)
Returns the value of attribute sheetid.
7 8 9 |
# File 'lib/creek/sheet.rb', line 7 def sheetid @sheetid end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
7 8 9 |
# File 'lib/creek/sheet.rb', line 7 def state @state end |
#visible ⇒ Object (readonly)
Returns the value of attribute visible.
7 8 9 |
# File 'lib/creek/sheet.rb', line 7 def visible @visible end |
Instance Method Details
#rows ⇒ Object
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_array ⇒ Object
40 41 42 |
# File 'lib/creek/sheet.rb', line 40 def rows_array rows_array_generator end |
#rows_with_meta_data ⇒ Object
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 |