Class: RubyExcel::Column
Overview
A Column in the Sheet
Instance Attribute Summary collapse
-
#idx ⇒ Object
(also: #index)
readonly
The Column letter.
-
#length ⇒ Object
readonly
The number of Rows in the Column.
Attributes inherited from Section
Instance Method Summary collapse
-
#<<(value) ⇒ Object
Append a value to the Column.
-
#initialize(sheet, idx) ⇒ Column
constructor
Creates a RubyExcel::Column instance.
Methods inherited from Section
#cell, #delete, #each, #each_cell, #each_cell_without_headers, #each_without_headers, #empty?, #find, #inspect, #last, #last_cell, #map!, #map_without_headers!, #read, #summarise, #to_s, #write
Methods included from Address
#address_to_col_index, #address_to_indices, #col_index, #col_letter, #column_id, #expand, #indices_to_address, #multi_array?, #offset, #row_id, #step_index, #to_range_address
Constructor Details
#initialize(sheet, idx) ⇒ Column
Creates a RubyExcel::Column instance
337 338 339 340 |
# File 'lib/rubyexcel/section.rb', line 337 def initialize( sheet, idx ) @idx = idx super( sheet ) end |
Instance Attribute Details
#idx ⇒ Object (readonly) Also known as: index
The Column letter
324 325 326 |
# File 'lib/rubyexcel/section.rb', line 324 def idx @idx end |
#length ⇒ Object (readonly)
The number of Rows in the Column
324 325 326 |
# File 'lib/rubyexcel/section.rb', line 324 def length @length end |
Instance Method Details
#<<(value) ⇒ Object
This only adds an extra cell if it is the first Column. This prevents a loop through Columns from extending diagonally away from the main data.
Append a value to the Column.
350 351 352 |
# File 'lib/rubyexcel/section.rb', line 350 def <<( value ) data[ translate_address( idx == 'A' ? data.rows + 1 : data.rows ) ] = value end |