Class: XLSX::Row
Instance Attribute Summary collapse
-
#max_col ⇒ Object
readonly
Returns the value of attribute max_col.
-
#min_col ⇒ Object
readonly
Returns the value of attribute min_col.
-
#row_number ⇒ Object
readonly
Returns the value of attribute row_number.
Instance Method Summary collapse
- #[]=(col_number, value) ⇒ Object
- #each ⇒ Object
-
#initialize(worksheet, row_number) ⇒ Row
constructor
A new instance of Row.
- #last ⇒ Object
Constructor Details
#initialize(worksheet, row_number) ⇒ Row
Returns a new instance of Row.
30 31 32 33 34 35 36 |
# File 'lib/xlsx/row.rb', line 30 def initialize(worksheet, row_number) @worksheet = worksheet @row_number = row_number @cells = {} @min_col = 0 @max_col = 0 end |
Instance Attribute Details
#max_col ⇒ Object (readonly)
Returns the value of attribute max_col.
28 29 30 |
# File 'lib/xlsx/row.rb', line 28 def max_col @max_col end |
#min_col ⇒ Object (readonly)
Returns the value of attribute min_col.
28 29 30 |
# File 'lib/xlsx/row.rb', line 28 def min_col @min_col end |
#row_number ⇒ Object (readonly)
Returns the value of attribute row_number.
28 29 30 |
# File 'lib/xlsx/row.rb', line 28 def row_number @row_number end |
Instance Method Details
#[]=(col_number, value) ⇒ Object
38 39 40 41 42 43 |
# File 'lib/xlsx/row.rb', line 38 def []=(col_number, value) raise "Column number must be a non-negative integer." unless col_number.is_a?(Integer) && col_number >= 0 @cells[col_number] = XLSX::Cell.new(@row_number, col_number, value) @min_col = col_number if col_number < @min_col @max_col = col_number if col_number > @max_col end |
#each ⇒ Object
45 46 47 48 49 |
# File 'lib/xlsx/row.rb', line 45 def each @cells.keys.sort.each do |col_no| yield @cells[col_no] end end |
#last ⇒ Object
51 52 53 |
# File 'lib/xlsx/row.rb', line 51 def last @cells[@cells.keys.sort.last] end |