lib/spreadsheet/excel/row.rb in spreadsheet-0.6.1.8 vs lib/spreadsheet/excel/row.rb in spreadsheet-0.6.1.9

- old
+ new

@@ -18,10 +18,15 @@ ## # Force convert the cell at _idx_ to a DateTime def datetime idx _datetime at(idx) end + def each &block + size.times do |idx| + block.call self[idx] + end + end ## # Access data in this Row like you would in an Array. If a cell is formatted # as a Date or DateTime, the decoded Date or DateTime value is returned. def [] idx, len=nil if len @@ -47,10 +52,14 @@ date end def _datetime data # :nodoc: return data if data.is_a?(DateTime) date = _date data - DateTime.new(date.year, date.month, date.day) + (data.to_f % 1) + hour = (data % 1) * 24 + min = (hour % 1) * 60 + sec = (min % 1) * 60 + DateTime.new(date.year, date.month, date.day, + hour.to_i, min.to_i, sec.round) end def enriched_data idx, data # :nodoc: res = nil if link = @worksheet.links[[@idx, idx]] res = link