summaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorSoutaro Matsumoto <[email protected]>2014-10-29 01:28:52 +0900
committerSoutaro Matsumoto <[email protected]>2014-10-29 01:54:39 +0900
commit5da13d60508f0ebacb3ba5afd3d29eb00c7ca59e (patch)
tree1bb50e72d7d7efc29d83806b51b06e43f59fa827 /lib
parent7cf747675097be13df633f1b2a5c45391df52b33 (diff)
downloadcaxlsx-5da13d60508f0ebacb3ba5afd3d29eb00c7ca59e.tar.gz
caxlsx-5da13d60508f0ebacb3ba5afd3d29eb00c7ca59e.zip
Skip to_time if the value is a Time instance
This skips calling `#to_time` if the value is a instance of subclass of `Time`, like `ActiveSupport::TimeWithZone`.
Diffstat (limited to 'lib')
-rw-r--r--lib/axlsx/workbook/worksheet/cell.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb
index cd9e1829..3136d0e0 100644
--- a/lib/axlsx/workbook/worksheet/cell.rb
+++ b/lib/axlsx/workbook/worksheet/cell.rb
@@ -452,7 +452,11 @@ module Axlsx
v
when :time
self.style = STYLE_DATE if self.style == 0
- v.respond_to?(:to_time) ? v.to_time : v
+ if !v.is_a?(Time) && v.respond_to?(:to_time)
+ v.to_time
+ else
+ v
+ end
when :float
v.to_f
when :integer