money 2.1.2 → 2.1.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/money/money.rb CHANGED
@@ -169,7 +169,15 @@ class Money
169
169
  end
170
170
  end
171
171
 
172
- symbol = rules[:symbol] ? rules[:symbol].empty? ? "$" : rules[:symbol] : "$"
172
+ if rules.has_key?(:symbol)
173
+ if rules[:symbol]
174
+ symbol = rules[:symbol]
175
+ else
176
+ symbol = ""
177
+ end
178
+ else
179
+ symbol = "$"
180
+ end
173
181
 
174
182
  if rules[:no_cents]
175
183
  formatted = sprintf("#{symbol}%d", cents.to_f / 100)
data/money.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "money"
3
- s.version = "2.1.2"
3
+ s.version = "2.1.3"
4
4
  s.summary = "Money and currency exchange support library"
5
5
  s.email = "hongli@phusion.nl"
6
6
  s.homepage = "http://money.rubyforge.org/"
data/test/money_spec.rb CHANGED
@@ -131,6 +131,13 @@ describe Money do
131
131
  Money.new(100, :currency => "GBP").format(:symbol => "£").should == "£1.00"
132
132
  end
133
133
 
134
+ specify "#format with :symbol == "", nil or false returns the amount without a symbol" do
135
+ money = Money.new(100, :currency => "GBP")
136
+ money.format(:symbol => "").should == "1.00"
137
+ money.format(:symbol => nil).should == "1.00"
138
+ money.format(:symbol => false).should == "1.00"
139
+ end
140
+
134
141
  specify "#format(:html => true) works as documented" do
135
142
  string = Money.ca_dollar(570).format(:html => true, :with_currency => true)
136
143
  string.should == "$5.70 <span class=\"currency\">CAD</span>"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: money
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke