i18n-complements 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -36,6 +36,10 @@ module I18nComplements
36
36
  self.code == other_currency.code
37
37
  end
38
38
 
39
+ def to_currency
40
+ self
41
+ end
42
+
39
43
  # Produces a amount of the currency with the locale parameters
40
44
  # TODO: Find a better way to specify number formats which are more complex that the default Rails use
41
45
  def localize(amount, options={})
@@ -85,6 +85,14 @@ module ::I18n
85
85
  end
86
86
  end
87
87
 
88
+ def currency_rate(from, to)
89
+ I18nComplements::Numisma.currency_rate(from, to)
90
+ end
91
+
92
+ def currencies_file
93
+ I18nComplements::Numisma.currencies_file
94
+ end
95
+
88
96
  end
89
97
 
90
98
  end
@@ -95,7 +95,23 @@ class TestCurrencies < Test::Unit::TestCase
95
95
  assert_nothing_raised do
96
96
  "USD".to_currency.name
97
97
  end
98
+
99
+ assert_nothing_raised do
100
+ :JPY.to_currency.to_currency.name
101
+ end
102
+
103
+ assert_nothing_raised do
104
+ :JPY.to_currency.to_currency.to_currency.name
105
+ end
106
+
107
+ assert_equal :JPY.to_currency, :JPY.to_currency.to_currency
108
+
109
+ currency = :JPY.to_currency
110
+
111
+ assert_equal currency, currency.to_currency
112
+ assert_equal currency.to_currency, currency.to_currency.to_currency
98
113
  end
99
114
 
100
115
 
116
+
101
117
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: i18n-complements
3
3
  version: !ruby/object:Gem::Version
4
4
  version: !binary |-
5
- MC4wLjM=
5
+ MC4wLjQ=
6
6
  prerelease:
7
7
  platform: ruby
8
8
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-07-23 00:00:00.000000000 Z
13
+ date: 2012-07-25 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: i18n