Class: RubyExcel::Cell
Overview
A single Cell
Instance Attribute Summary
Attributes inherited from Element
#address, #column, #data, #row, #sheet
Instance Method Summary collapse
-
#initialize(sheet, addr) ⇒ Cell
constructor
A new instance of Cell.
-
#to_s ⇒ Object
The data at address as a String.
-
#value ⇒ Object
Return the value at this Cell’s address.
-
#value=(val) ⇒ Object
Set the value at this Cell’s address.
Methods inherited from Element
#delete, #each, #each_cell, #empty?, #first_cell, #inspect, #last_cell, #map!
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, addr) ⇒ Cell
Returns a new instance of Cell.
121 122 123 124 |
# File 'lib/rubyexcel/element.rb', line 121 def initialize( sheet, addr ) fail ArgumentError, "Invalid Cell address: #{ addr }" unless addr =~ /\A[A-Z]{1,3}\d+\z/i super end |
Instance Method Details
#to_s ⇒ Object
The data at address as a String
150 151 152 |
# File 'lib/rubyexcel/element.rb', line 150 def to_s val.to_s end |
#value ⇒ Object
Return the value at this Cell’s address
132 133 134 |
# File 'lib/rubyexcel/element.rb', line 132 def value data[ address ] end |
#value=(val) ⇒ Object
Set the value at this Cell’s address
142 143 144 |
# File 'lib/rubyexcel/element.rb', line 142 def value=( val ) data[ address ] = val end |