sevenwire-money 2.1.0 → 2.1.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/lib/money/currencies.rb +37 -0
- data/money.gemspec +2 -1
- metadata +2 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
class Money
|
|
2
|
+
|
|
3
|
+
# Creates a new Money object of the given value, using the Canadian dollar currency.
|
|
4
|
+
def self.ca_dollar(cents)
|
|
5
|
+
new(cents, "CAD")
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
# Creates a new Money object of the given value, using the American dollar currency.
|
|
9
|
+
def self.us_dollar(cents)
|
|
10
|
+
new(cents, "USD")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# Creates a new Money object of the given value, using the Euro currency.
|
|
14
|
+
def self.euro(cents)
|
|
15
|
+
new(cents, "EUR")
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
# Recieve a money object with the same amount as the current Money object
|
|
20
|
+
# in american dollar
|
|
21
|
+
def as_us_dollar
|
|
22
|
+
exchange_to("USD")
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
# Recieve a money object with the same amount as the current Money object
|
|
26
|
+
# in canadian dollar
|
|
27
|
+
def as_ca_dollar
|
|
28
|
+
exchange_to("CAD")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Recieve a money object with the same amount as the current Money object
|
|
32
|
+
# in euro
|
|
33
|
+
def as_euro
|
|
34
|
+
exchange_to("EUR")
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
end
|
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.
|
|
3
|
+
s.version = "2.1.1"
|
|
4
4
|
s.summary = "Money and currency exchange support library"
|
|
5
5
|
s.email = "brandon@sevenwire.com"
|
|
6
6
|
s.homepage = "http://github.com/sevenwire/money"
|
|
@@ -13,6 +13,7 @@ Gem::Specification.new do |s|
|
|
|
13
13
|
"README.rdoc", "MIT-LICENSE", "money.gemspec", "Rakefile",
|
|
14
14
|
"lib/money.rb",
|
|
15
15
|
"lib/money/core_extensions.rb",
|
|
16
|
+
"lib/money/currencies.rb",
|
|
16
17
|
"lib/money/errors.rb",
|
|
17
18
|
"lib/money/money.rb",
|
|
18
19
|
"lib/money/variable_exchange_bank.rb",
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sevenwire-money
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tobias Luetke
|
|
@@ -30,6 +30,7 @@ files:
|
|
|
30
30
|
- Rakefile
|
|
31
31
|
- lib/money.rb
|
|
32
32
|
- lib/money/core_extensions.rb
|
|
33
|
+
- lib/money/currencies.rb
|
|
33
34
|
- lib/money/errors.rb
|
|
34
35
|
- lib/money/money.rb
|
|
35
36
|
- lib/money/variable_exchange_bank.rb
|