papla 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm use 1.9.3@papla
1
+ rvm --create 1.9.3@papla
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.0.5 (2012-01-21)
2
+
3
+ * Make converting decimal points more robust
4
+
1
5
  ### 0.0.4 (2012-01-21)
2
6
 
3
7
  * support English locale
data/lib/papla.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'bigdecimal'
2
+ require 'bigdecimal/util'
1
3
  require 'papla/backend'
2
4
  require 'papla/version'
3
5
 
@@ -116,7 +118,7 @@ module Papla
116
118
  end
117
119
 
118
120
  def self.append_cents(basic_phrase, number)
119
- cents = 100 * (number - number.to_i)
121
+ cents = 100 * (number.to_d - number.to_i)
120
122
  spell_cents(basic_phrase, cents)
121
123
  end
122
124
 
data/lib/papla/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Papla
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
data/papla.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
  s.email = ["olek.janiszewski@gmail.com"]
10
10
  s.homepage = "https://github.com/exviva/papla"
11
11
  s.summary = %q{Use Ruby to convert numbers into Polish and English words}
12
- s.description = %q{Papla is a Ruby gem that allows you to convert numbers into Polish and English words (e.g. `153` into `"Sto pięćdziesiąt trzy"` or `44` into `"Forty four"`), including the decimal part as cents and currency symbol. Its primary use case are invoices, where the total amount has to be displayed as words at the bottom line.}
12
+ s.description = %q{Papla is a Ruby gem that allows you to convert numbers into Polish and English words.}
13
13
 
14
14
  s.rubyforge_project = "papla"
15
15
 
data/spec/en_spec.rb CHANGED
@@ -231,5 +231,9 @@ describe Papla, 'en' do
231
231
  it 'rounds to two decimal places' do
232
232
  subject[3.456].should eq('Three 46/100')
233
233
  end
234
+
235
+ it 'properly handles float precision imperfections' do
236
+ subject[111_111.2].should eq('One hundred eleven thousand one hundred eleven 20/100')
237
+ end
234
238
  end
235
239
  end
data/spec/pl_spec.rb CHANGED
@@ -232,5 +232,9 @@ describe Papla, 'pl' do
232
232
  it 'rounds to two decimal places' do
233
233
  subject[3.456].should eq('Trzy 46/100')
234
234
  end
235
+
236
+ it 'properly handles float precision imperfections' do
237
+ subject[111_111.2].should eq('Sto jedenaście tysięcy sto jedenaście 20/100')
238
+ end
235
239
  end
236
240
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: papla
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-21 00:00:00.000000000 Z
12
+ date: 2012-03-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: i18n
16
- requirement: &16305740 !ruby/object:Gem::Requirement
16
+ requirement: &9548560 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *16305740
24
+ version_requirements: *9548560
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &16304540 !ruby/object:Gem::Requirement
27
+ requirement: &9547300 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.8.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *16304540
35
+ version_requirements: *9547300
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &16302140 !ruby/object:Gem::Requirement
38
+ requirement: &9546380 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,11 +43,9 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *16302140
46
+ version_requirements: *9546380
47
47
  description: Papla is a Ruby gem that allows you to convert numbers into Polish and
48
- English words (e.g. `153` into `"Sto pięćdziesiąt trzy"` or `44` into `"Forty four"`),
49
- including the decimal part as cents and currency symbol. Its primary use case are
50
- invoices, where the total amount has to be displayed as words at the bottom line.
48
+ English words.
51
49
  email:
52
50
  - olek.janiszewski@gmail.com
53
51
  executables: []
@@ -93,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
91
  version: '0'
94
92
  requirements: []
95
93
  rubyforge_project: papla
96
- rubygems_version: 1.8.10
94
+ rubygems_version: 1.8.15
97
95
  signing_key:
98
96
  specification_version: 3
99
97
  summary: Use Ruby to convert numbers into Polish and English words