mmorga-money 2.1.5 → 2.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/money/money.rb +4 -2
- data/money.gemspec +1 -1
- data/test/money_spec.rb +4 -0
- metadata +1 -1
data/lib/money/money.rb
CHANGED
@@ -226,8 +226,10 @@ class Money
|
|
226
226
|
end
|
227
227
|
|
228
228
|
# Commify ("10000" => "10,000")
|
229
|
-
|
230
|
-
|
229
|
+
unless rules[:no_commas]
|
230
|
+
formatted.gsub!(/(\d)(?=\d{3}+(?:\.|$))(\d{3}\..*)?/,'\1,\2')
|
231
|
+
end
|
232
|
+
|
231
233
|
if rules[:with_currency]
|
232
234
|
formatted << " "
|
233
235
|
formatted << '<span class="currency">' if rules[:html]
|
data/money.gemspec
CHANGED
data/test/money_spec.rb
CHANGED
@@ -202,6 +202,10 @@ describe Money do
|
|
202
202
|
Money.us_dollar(1_000_000_000_12).format.should == "$1,000,000,000.12"
|
203
203
|
Money.us_dollar(1_000_000_000_12).format(:no_cents => true).should == "$1,000,000,000"
|
204
204
|
end
|
205
|
+
|
206
|
+
it "should not insert commas into the result if the :no_commas included" do
|
207
|
+
Money.us_dollar(1_000_000_000_12).format(:no_commas).should == "$1000000000.12"
|
208
|
+
end
|
205
209
|
end
|
206
210
|
end
|
207
211
|
|