lib/rspreadsheet/cell.rb in rspreadsheet-0.4.8 vs lib/rspreadsheet/cell.rb in rspreadsheet-0.4.9
- old
+ new
@@ -31,12 +31,11 @@
attr_accessor :worksheet
# Row index of a cell. If you want to access the row object, see #row.
attr_reader :rowi
# @!group XMLTiedItem related methods and extensions
- def xml_options; {:xml_items_node_name => 'table-cell', :xml_repeated_attribute => 'number-columns-repeated'} end
- def parent; row end
+ def parent; row end #TODO: otazka zda je treba definovat zde, mozna uz je to v XMLTiedItem osefovano
def coli; index end
def set_rowi(arowi); @rowi = arowi end # this should ONLY be used by parent row
def initialize(aworksheet,arowi,acoli)
raise "First parameter should be Worksheet object not #{aworksheet.class}" unless aworksheet.kind_of?(Rspreadsheet::Worksheet)
@@ -63,23 +62,24 @@
def inspect
"#<Rspreadsheet::Cell\n row:#{rowi}, col:#{coli} address:#{address}\n type: #{guess_cell_type.to_s}, value:#{value}\n mode: #{mode}, format: #{format.inspect}\n>"
end
def value
gt = guess_cell_type
- if (self.mode == :regular) or (self.mode == :repeated)
+ amode = self.mode
+ if (amode == :regular) or (amode == :repeated)
case
when gt == nil then nil
when gt == Float then xmlnode.attributes['value'].to_f
when gt == String then xmlnode.elements.first.andand.content.to_s
when gt == :datetime then datetime_value
when gt == :time then time_value
when gt == :percentage then xmlnode.attributes['value'].to_f
when gt == :currency then xmlnode.attributes['value'].to_d
end
- elsif self.mode == :outbound
+ elsif amode == :outbound
nil
else
- raise "Unknown cell mode #{self.mode}"
+ raise "Unknown cell mode #{amode}"
end
end
## according to http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1417674_253892949
## the value od time-value is in a "duration" format defined here https://www.w3.org/TR/xmlschema-2/#duration