CurrencyString 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ 2007-07-05 - 0.0.1
2
+ Initial release
3
+
4
+ 2007-07-05 - 0.0.2
5
+ Some fix on the million strings
@@ -54,6 +54,7 @@ module CurrencyString
54
54
  str = []
55
55
  escalas = @@currencystr_config[lang]["scales"]
56
56
  separators = @@currencystr_config[lang]["separators"]
57
+ posts = @@currencystr_config[lang]["post"] || []
57
58
  currency = integer.to_i > 1 ? escalas[1][1] : escalas[0][1]
58
59
  currency.strip!
59
60
 
@@ -72,6 +73,10 @@ module CurrencyString
72
73
  str << build_value(0,cents,lang)
73
74
  str << (cents.to_i == 1 ? escalas[0][0] : escalas[1][0]).strip
74
75
  end
75
- str.join(" ").strip.gsub(/ ,/,",")
76
+ str = str.join(" ").strip.gsub(/ ,/,",")
77
+ for post in posts
78
+ str.sub!(post[0],post[1])
79
+ end
80
+ str
76
81
  end
77
82
  end
@@ -77,6 +77,13 @@ pt_BR:
77
77
  - ", "
78
78
  - ", "
79
79
  - ", "
80
+ post:
81
+ -
82
+ - !ruby/regexp /(milh)(�o|�es)( )(reais)/
83
+ - "\\1\\2 de \\4"
84
+ -
85
+ - !ruby/regexp /(milh)(�es|�o)(,)( ?)(\w+)( reais)/
86
+ - "\\1\\2 e\\4\\5\\6"
80
87
  en_US:
81
88
  numbers:
82
89
  - " "
@@ -156,3 +163,7 @@ en_US:
156
163
  - ", "
157
164
  - ", "
158
165
  - ", "
166
+ post:
167
+ -
168
+ - !ruby/regexp /(million)(,)( ?)(\w+)( dollars)/
169
+ - "\\1 and\\3\\4\\5"
@@ -54,8 +54,12 @@ class CurrencyTest < Test::Unit::TestCase
54
54
  assert_equal("one hundred twenty three thousand, four hundred fifty six dollars and seventy eight cents",123_456.78.to_currency_s("en_US"))
55
55
  end
56
56
  def test_millions
57
- assert_equal("um milh�o reais",1_000_000.00.to_currency_s("pt_BR"))
58
- assert_equal("one million dollars",1_000_000.00.to_currency_s("en_US"))
57
+ assert_equal("um milh�o de reais" ,1_000_000.00.to_currency_s("pt_BR"))
58
+ assert_equal("one million dollars" ,1_000_000.00.to_currency_s("en_US"))
59
+ assert_equal("um milh�o e dez reais" ,1_000_010.00.to_currency_s("pt_BR"))
60
+ assert_equal("one million and ten dollars" ,1_000_010.00.to_currency_s("en_US"))
61
+ assert_equal("dois milh�es de reais",2_000_000.00.to_currency_s("pt_BR"))
62
+ assert_equal("two million dollars" ,2_000_000.00.to_currency_s("en_US"))
59
63
  assert_equal("um milh�o, dez mil reais e dez centavos",1_010_000.10.to_currency_s("pt_BR"))
60
64
  assert_equal("one million, ten thousand dollars and ten cents",1_010_000.10.to_currency_s("en_US"))
61
65
  assert_equal("um milh�o, duzentos e trinta e quatro mil, quinhentos e sessenta e sete reais e oitenta e nove centavos",1_234_567.89.to_currency_s("pt_BR"))
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: CurrencyString
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.0.1
6
+ version: 0.0.2
7
7
  date: 2007-07-05 00:00:00 -03:00
8
8
  summary: Convert a Float into its String representation
9
9
  require_paths:
@@ -52,6 +52,7 @@ files:
52
52
  - test/test_currencystring.rb
53
53
  - README
54
54
  - COPYING
55
+ - Changelog
55
56
  test_files:
56
57
  - test/test_currencystring.rb
57
58
  rdoc_options: []
@@ -59,6 +60,7 @@ rdoc_options: []
59
60
  extra_rdoc_files:
60
61
  - README
61
62
  - COPYING
63
+ - Changelog
62
64
  executables: []
63
65
 
64
66
  extensions: []