sevenwire-money 2.3.5 → 2.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/money/money.rb +7 -5
  2. data/money.gemspec +3 -3
  3. metadata +4 -4
@@ -174,17 +174,19 @@ class Money
174
174
  rules = rules.flatten
175
175
 
176
176
  if rules.include?(:tenths)
177
- formatted = sprintf("$%.3f", millicents.to_f / 100000)
177
+ formatted = sprintf("%.3f", millicents.to_f.abs / 100000)
178
178
  elsif rules.include?(:hundredths)
179
- formatted = sprintf("$%.4f", millicents.to_f / 100000)
179
+ formatted = sprintf("%.4f", millicents.to_f.abs / 100000)
180
180
  elsif rules.include?(:thousandths)
181
- formatted = sprintf("$%.5f", millicents.to_f / 100000)
181
+ formatted = sprintf("%.5f", millicents.to_f.abs / 100000)
182
182
  elsif rules.include?(:no_cents)
183
- formatted = sprintf("$%d", cents.to_f / 100)
183
+ formatted = sprintf("%d", cents.to_f.abs / 100)
184
184
  else
185
- formatted = sprintf("$%.2f", cents.to_f / 100)
185
+ formatted = sprintf("%.2f", cents.to_f.abs / 100)
186
186
  end
187
187
 
188
+ formatted = "#{millicents < 0 ? '-$' : '$'}#{formatted}"
189
+
188
190
  if rules.include?(:with_currency)
189
191
  formatted << " "
190
192
  formatted << '<span class="currency">' if rules.include?(:html)
@@ -1,10 +1,10 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "money"
3
- s.version = "2.3.5"
4
- s.summary = "Money and MicroMoney with currency exchange support library"
3
+ s.version = "2.3.6"
4
+ s.summary = "Money and MicroMoney with currency exchange support library (with millicents)"
5
5
  s.email = "brandon@sevenwire.com"
6
6
  s.homepage = "http://github.com/sevenwire/money"
7
- s.description = "Money and MicroMoney with currency exchange support library."
7
+ s.description = "Money and MicroMoney with currency exchange support library (with millicents)."
8
8
  s.has_rdoc = true
9
9
  s.rubyforge_project = "money"
10
10
  s.authors = ["Tobias Luetke", "Hongli Lai", "Brandon Arbini"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sevenwire-money
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.5
4
+ version: 2.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
@@ -11,11 +11,11 @@ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
13
 
14
- date: 2008-12-22 00:00:00 -08:00
14
+ date: 2009-02-25 00:00:00 -08:00
15
15
  default_executable:
16
16
  dependencies: []
17
17
 
18
- description: Money and MicroMoney with currency exchange support library.
18
+ description: Money and MicroMoney with currency exchange support library (with millicents).
19
19
  email: brandon@sevenwire.com
20
20
  executables: []
21
21
 
@@ -63,6 +63,6 @@ rubyforge_project: money
63
63
  rubygems_version: 1.2.0
64
64
  signing_key:
65
65
  specification_version: 2
66
- summary: Money and MicroMoney with currency exchange support library
66
+ summary: Money and MicroMoney with currency exchange support library (with millicents)
67
67
  test_files: []
68
68