simple_currency 1.3.0 → 1.3.1
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.
- data/Gemfile +1 -1
- data/Gemfile.lock +10 -10
- data/VERSION +1 -1
- data/lib/simple_currency/currency_convertible.rb +0 -23
- data/simple_currency.gemspec +2 -2
- data/spec/simple_currency_spec.rb +5 -0
- metadata +3 -12
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -69,16 +69,16 @@ GEM
|
|
69
69
|
rake (>= 0.8.4)
|
70
70
|
thor (~> 0.14.0)
|
71
71
|
rake (0.8.7)
|
72
|
-
rspec (2.0.
|
73
|
-
rspec-core (
|
74
|
-
rspec-expectations (
|
75
|
-
rspec-mocks (
|
76
|
-
rspec-core (2.0.
|
77
|
-
rspec-expectations (2.0.
|
72
|
+
rspec (2.0.1)
|
73
|
+
rspec-core (~> 2.0.1)
|
74
|
+
rspec-expectations (~> 2.0.1)
|
75
|
+
rspec-mocks (~> 2.0.1)
|
76
|
+
rspec-core (2.0.1)
|
77
|
+
rspec-expectations (2.0.1)
|
78
78
|
diff-lcs (>= 1.1.2)
|
79
|
-
rspec-mocks (2.0.
|
80
|
-
rspec-core (
|
81
|
-
rspec-expectations (
|
79
|
+
rspec-mocks (2.0.1)
|
80
|
+
rspec-core (~> 2.0.1)
|
81
|
+
rspec-expectations (~> 2.0.1)
|
82
82
|
rubyforge (2.0.4)
|
83
83
|
json_pure (>= 1.1.7)
|
84
84
|
simplecov (0.3.6)
|
@@ -98,5 +98,5 @@ DEPENDENCIES
|
|
98
98
|
fakeweb
|
99
99
|
jeweler
|
100
100
|
rails
|
101
|
-
rspec (>= 2.0.
|
101
|
+
rspec (>= 2.0.1)
|
102
102
|
simplecov
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.1
|
@@ -4,29 +4,6 @@ require 'crack/xml'
|
|
4
4
|
|
5
5
|
module CurrencyConvertible
|
6
6
|
|
7
|
-
Operators = {:+ => :add,
|
8
|
-
:- => :subtract}
|
9
|
-
|
10
|
-
def add_with_currency(arg)
|
11
|
-
return add_without_currency(arg) unless arg.is_a? CurrencyConvertible::Proxy
|
12
|
-
add_without_currency(arg)
|
13
|
-
end
|
14
|
-
|
15
|
-
def subtract_with_currency(arg)
|
16
|
-
return subtract_without_currency(arg) unless arg.is_a? CurrencyConvertible::Proxy
|
17
|
-
subtract_without_currency(arg)
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.included(base)
|
21
|
-
base.send(:alias_method, :add_without_currency, :+)
|
22
|
-
base.send(:undef_method, :+)
|
23
|
-
base.send(:alias_method, :+, :add_with_currency)
|
24
|
-
|
25
|
-
base.send(:alias_method, :subtract_without_currency, :-)
|
26
|
-
base.send(:undef_method, :-)
|
27
|
-
base.send(:alias_method, :-, :subtract_with_currency)
|
28
|
-
end
|
29
|
-
|
30
7
|
def method_missing(method, *args, &block)
|
31
8
|
return CurrencyConvertible::Proxy.new(self,method.to_s) if method.to_s.length == 3 # Presumably a currency ("eur", "gbp"...)
|
32
9
|
super(method,*args,&block)
|
data/simple_currency.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{simple_currency}
|
8
|
-
s.version = "1.3.
|
8
|
+
s.version = "1.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Oriol Gual", "Josep M. Bach", "Josep Jaume Rey"]
|
12
|
-
s.date = %q{2010-10-
|
12
|
+
s.date = %q{2010-10-25}
|
13
13
|
s.description = %q{A really simple currency converter using XavierMedia API. It's Ruby 1.8, 1.9 and JRuby compatible, and it also takes advantage of Rails cache when available.}
|
14
14
|
s.email = %q{info@codegram.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -29,6 +29,8 @@ describe "SimpleCurrency" do
|
|
29
29
|
(1 + 1.27).should == 2.27
|
30
30
|
(38.eur + 1.27).should == 39.27
|
31
31
|
(1.27.usd + 38).should == 39.27
|
32
|
+
(2.27 + 1.usd).should == 3.27
|
33
|
+
(2 + 1.usd).should == 3
|
32
34
|
end
|
33
35
|
end
|
34
36
|
|
@@ -43,7 +45,10 @@ describe "SimpleCurrency" do
|
|
43
45
|
(1 - 1.27).should == -0.27
|
44
46
|
(38.eur - 1.27).should == 36.73
|
45
47
|
(1.27.usd - 38).should == -36.73
|
48
|
+
(3.27 - 2.usd).should == 1.27
|
49
|
+
(2 - 1.usd).should == 1
|
46
50
|
end
|
51
|
+
|
47
52
|
end
|
48
53
|
|
49
54
|
end
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_currency
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 27
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 1
|
8
7
|
- 3
|
9
|
-
-
|
10
|
-
version: 1.3.
|
8
|
+
- 1
|
9
|
+
version: 1.3.1
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Oriol Gual
|
@@ -17,7 +16,7 @@ autorequire:
|
|
17
16
|
bindir: bin
|
18
17
|
cert_chain: []
|
19
18
|
|
20
|
-
date: 2010-10-
|
19
|
+
date: 2010-10-25 00:00:00 +02:00
|
21
20
|
default_executable:
|
22
21
|
dependencies:
|
23
22
|
- !ruby/object:Gem::Dependency
|
@@ -28,7 +27,6 @@ dependencies:
|
|
28
27
|
requirements:
|
29
28
|
- - ">="
|
30
29
|
- !ruby/object:Gem::Version
|
31
|
-
hash: 11
|
32
30
|
segments:
|
33
31
|
- 0
|
34
32
|
- 1
|
@@ -44,7 +42,6 @@ dependencies:
|
|
44
42
|
requirements:
|
45
43
|
- - ">="
|
46
44
|
- !ruby/object:Gem::Version
|
47
|
-
hash: 7
|
48
45
|
segments:
|
49
46
|
- 1
|
50
47
|
- 4
|
@@ -60,7 +57,6 @@ dependencies:
|
|
60
57
|
requirements:
|
61
58
|
- - ">="
|
62
59
|
- !ruby/object:Gem::Version
|
63
|
-
hash: 3192703827556712861
|
64
60
|
segments:
|
65
61
|
- 2
|
66
62
|
- 0
|
@@ -78,7 +74,6 @@ dependencies:
|
|
78
74
|
requirements:
|
79
75
|
- - ">="
|
80
76
|
- !ruby/object:Gem::Version
|
81
|
-
hash: 27
|
82
77
|
segments:
|
83
78
|
- 1
|
84
79
|
- 3
|
@@ -94,7 +89,6 @@ dependencies:
|
|
94
89
|
requirements:
|
95
90
|
- - ">="
|
96
91
|
- !ruby/object:Gem::Version
|
97
|
-
hash: 7
|
98
92
|
segments:
|
99
93
|
- 3
|
100
94
|
- 0
|
@@ -110,7 +104,6 @@ dependencies:
|
|
110
104
|
requirements:
|
111
105
|
- - ">="
|
112
106
|
- !ruby/object:Gem::Version
|
113
|
-
hash: 23
|
114
107
|
segments:
|
115
108
|
- 1
|
116
109
|
- 0
|
@@ -162,7 +155,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
162
155
|
requirements:
|
163
156
|
- - ">="
|
164
157
|
- !ruby/object:Gem::Version
|
165
|
-
hash: 3
|
166
158
|
segments:
|
167
159
|
- 0
|
168
160
|
version: "0"
|
@@ -171,7 +163,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
163
|
requirements:
|
172
164
|
- - ">="
|
173
165
|
- !ruby/object:Gem::Version
|
174
|
-
hash: 3
|
175
166
|
segments:
|
176
167
|
- 0
|
177
168
|
version: "0"
|