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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a2d8d287bb71584ad802cd18d4414c4961188dbb
4
- data.tar.gz: 2fb3326dbdd89711ae5f3e3dea251c117d7b4016
3
+ metadata.gz: bcdbcc4b2c9bf8c316381cf55c89c5e23645574a
4
+ data.tar.gz: 4333f7da4b0d26a12278612512cdfdc2c69a208d
5
5
  SHA512:
6
- metadata.gz: 088059597e1261b79a0f94fef327042b48c83819c2348f809aab35a62303b2a9f8b7629f25c30759425c5e471e7327259c6f292cdb58590ae7555c3b80d2a2a1
7
- data.tar.gz: 304a17f577bb54a2292995b7504f44956584bd55b8bab7608127ab4fa14571331dd6ea61cf3c588c7e8185c9f30d7b2721f3604a76464c87704a490b79c45054
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}/)
@@ -3,7 +3,7 @@ module Spreet
3
3
  module VERSION
4
4
  MAJOR = "0"
5
5
  MINOR = "0"
6
- PATCH = "4"
6
+ PATCH = "5"
7
7
  STRING = [MAJOR, MINOR, PATCH].join('.').freeze
8
8
  end
9
9
 
Binary file
@@ -4,14 +4,14 @@ require 'helper'
4
4
  class TestOpenDocument < SpreetTest
5
5
 
6
6
  def test_read_and_write
7
- doc = nil
8
- assert_nothing_raised do
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
- assert_nothing_raised do
13
- doc.write("tmp/rewrited-pascal.ods")
14
- end
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spreet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brice Texier