lib/rspreadsheet/cell.rb in rspreadsheet-0.2.14 vs lib/rspreadsheet/cell.rb in rspreadsheet-0.2.15
- old
+ new
@@ -5,14 +5,12 @@
require 'andand'
require 'rspreadsheet/xml_tied'
require 'date'
require 'bigdecimal'
require 'bigdecimal/util' # for to_d method
-require 'helpers/class_extensions'
module Rspreadsheet
-using ClassExtensions if RUBY_VERSION > '2.1'
###
# Represents a cell in spreadsheet which has coordinates, contains value, formula and can be formated.
# You can get this object like this (suppose that @worksheet contains {Rspreadsheet::Worksheet} object)
#
@@ -40,11 +38,11 @@
end
def row; @worksheet.rows(rowi) end
def coordinates; [rowi,coli] end
def to_s; value.to_s end
def valuexml; self.valuexmlnode.andand.inner_xml end
- def valuexmlnode; self.xmlnode.elements.first end
+ def valuexmlnode; self.xmlnode.children.first end
# use this to find node in cell xml. ex. xmlfind('.//text:a') finds all link nodes
def valuexmlfindall(path)
valuexmlnode.nil? ? [] : valuexmlnode.find(path)
end
def valuexmlfindfirst(path)
@@ -150,13 +148,13 @@
when 'date' then Date
when 'percentage' then :percentage
when 'N/A' then :unassigned
when 'currency' then :currency
else
- if xmlnode.elements.size == 0
+ if xmlnode.children.size == 0
nil
else
- raise "Unknown type at #{coordinates.to_s} from #{xmlnode.to_s} / elements size=#{xmlnode.elements.size.to_s} / type=#{xmlnode.attributes['value-type'].to_s}"
+ raise "Unknown type at #{coordinates.to_s} from #{xmlnode.to_s} / children size=#{xmlnode.children.size.to_s} / type=#{xmlnode.attributes['value-type'].to_s}"
end
end
result =
if !typeguess.nil? # if not certain by value, but have a typeguess