spreet 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spreet/handlers/open_document.rb +2 -2
- data/lib/spreet/version.rb +1 -1
- data/test/samples/pascal.ods +0 -0
- data/test/test_open_document.rb +7 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bcdbcc4b2c9bf8c316381cf55c89c5e23645574a
|
4
|
+
data.tar.gz: 4333f7da4b0d26a12278612512cdfdc2c69a208d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e2dfbf873d6c68c673f2f83656941522123588675f9b6b65c18b617f943b6a738d1983ac9b8f8ad9e087c0dfa0251df53c192d53b1c7d14e7521144bb9f77c9
|
7
|
+
data.tar.gz: 0beafe1ccd76c653bfaad2a4dd9a2222b606bfb8773863abf606db6fc0012e98ffe7a7689b33503666a40dec54d377a23bf7b853e51b34e32810cf26be74b07a
|
@@ -137,8 +137,8 @@ module Spreet
|
|
137
137
|
sheet[x,y] = value.to_f
|
138
138
|
elsif value_type == :currency
|
139
139
|
value = cell.attributes.get_attribute_ns(XMLNS_OFFICE, "value").value
|
140
|
-
currency = cell.attributes.get_attribute_ns(XMLNS_OFFICE, "currency").value
|
141
|
-
sheet[x,y] = Money.new(value.to_f, currency)
|
140
|
+
currency = Money::Currency.new(cell.attributes.get_attribute_ns(XMLNS_OFFICE, "currency").value)
|
141
|
+
sheet[x,y] = Money.new(value.to_f * currency.subunit_to_unit, currency)
|
142
142
|
elsif value_type == :date
|
143
143
|
value = cell.attributes.get_attribute_ns(XMLNS_OFFICE, "date-value").value
|
144
144
|
if value.match(/\d{1,8}-\d{1,2}-\d{1,2}/)
|
data/lib/spreet/version.rb
CHANGED
data/test/samples/pascal.ods
CHANGED
Binary file
|
data/test/test_open_document.rb
CHANGED
@@ -4,14 +4,14 @@ require 'helper'
|
|
4
4
|
class TestOpenDocument < SpreetTest
|
5
5
|
|
6
6
|
def test_read_and_write
|
7
|
-
doc =
|
8
|
-
|
9
|
-
doc = Spreet::Document.read("test/samples/pascal.ods")
|
10
|
-
end
|
7
|
+
doc = Spreet::Document.read("test/samples/pascal.ods")
|
8
|
+
sheet = doc.sheets["Datatypes"]
|
11
9
|
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
assert_equal 12.34, sheet["A2"].value.to_f
|
11
|
+
assert_equal 123.45, sheet["A3"].value.to_f
|
12
|
+
assert_equal 123456, sheet["A4"].value.to_f
|
13
|
+
|
14
|
+
doc.write("tmp/rewrited-pascal.ods")
|
15
15
|
end
|
16
16
|
|
17
17
|
end
|