money 6.0.0.pre → 6.0.0.pre2
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.
- checksums.yaml +4 -4
- data/lib/money/core_extensions.rb +4 -6
- data/lib/money/money/parsing.rb +4 -1
- data/money.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db3de84c7fca4fad50f28617c05aa96b0a8cd2f9
|
4
|
+
data.tar.gz: 3a22bb6c242e6b96660f78add455217a5eac3e5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c55f42b4d76f62ba787b54ef929d202f1edd873d9abc7139fc1cb8e5276f59263d293f4b1c316e35cf814493c211598adee7812b83d23f60e51d276d7bbe6919
|
7
|
+
data.tar.gz: c6b9250d167858e374ab2ae18da527aa4d3c06017a60cb8574190da4afca629020bdf18d4e0005abd2fd48b80dbced701b61e16bce81dbf78aee87b83933437a
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# Open +Numeric+ to add new method.
|
2
2
|
class Numeric
|
3
|
-
|
4
3
|
# Converts this numeric into a +Money+ object in the given +currency+.
|
5
4
|
#
|
6
5
|
# @param [Currency, String, Symbol] currency
|
@@ -16,14 +15,13 @@ class Numeric
|
|
16
15
|
# @see Money.from_numeric
|
17
16
|
#
|
18
17
|
def to_money(currency = nil)
|
18
|
+
Money.deprecate "as of Money 6.1.0 you must `require 'money/core_extension'` to use Numeric#to_money."
|
19
19
|
Money.from_numeric(self, currency || Money.default_currency)
|
20
20
|
end
|
21
|
-
|
22
21
|
end
|
23
22
|
|
24
23
|
# Open +String+ to add new methods.
|
25
24
|
class String
|
26
|
-
|
27
25
|
# Parses the current string and converts it to a +Money+ object.
|
28
26
|
# Excess characters will be discarded.
|
29
27
|
#
|
@@ -43,6 +41,7 @@ class String
|
|
43
41
|
# @see Money.from_string
|
44
42
|
#
|
45
43
|
def to_money(currency = nil)
|
44
|
+
Money.deprecate "String#to_money is depreciated and will be remove in 6.1.0. Please write your own parsing methods."
|
46
45
|
Money.parse(self, currency)
|
47
46
|
end
|
48
47
|
|
@@ -57,14 +56,13 @@ class String
|
|
57
56
|
# "USD".to_currency #=> #<Money::Currency id: usd>
|
58
57
|
#
|
59
58
|
def to_currency
|
59
|
+
Money.deprecate "as of Money 6.1.0 you must `require 'money/core_extension'` to use String#to_currency."
|
60
60
|
Money::Currency.new(self)
|
61
61
|
end
|
62
|
-
|
63
62
|
end
|
64
63
|
|
65
64
|
# Open +Symbol+ to add new methods.
|
66
65
|
class Symbol
|
67
|
-
|
68
66
|
# Converts the current symbol into a +Currency+ object.
|
69
67
|
#
|
70
68
|
# @return [Money::Currency]
|
@@ -76,7 +74,7 @@ class Symbol
|
|
76
74
|
# :ars.to_currency #=> #<Money::Currency id: ars>
|
77
75
|
#
|
78
76
|
def to_currency
|
77
|
+
Money.deprecate "as of Money 6.1.0 you must `require 'money/core_extension'` to use Symbol#to_currency."
|
79
78
|
Money::Currency.new(self)
|
80
79
|
end
|
81
|
-
|
82
80
|
end
|
data/lib/money/money/parsing.rb
CHANGED
@@ -97,6 +97,7 @@ class Money
|
|
97
97
|
# @see #parse
|
98
98
|
#
|
99
99
|
def from_string(value, currency = Money.default_currency)
|
100
|
+
Money.deprecate ".from_string is depreciated and will be remove in 6.1.0. Please write your own parsing methods."
|
100
101
|
from_bigdecimal(BigDecimal.new(value.to_s), currency)
|
101
102
|
end
|
102
103
|
|
@@ -156,6 +157,7 @@ class Money
|
|
156
157
|
# @see #from_numeric
|
157
158
|
#
|
158
159
|
def from_float(value, currency = Money.default_currency)
|
160
|
+
Money.deprecate ".from_float is depreciated and will be remove in 6.1.0. Please write your own parsing methods."
|
159
161
|
from_bigdecimal(BigDecimal.new(value.to_s), currency)
|
160
162
|
end
|
161
163
|
|
@@ -218,7 +220,6 @@ class Money
|
|
218
220
|
#
|
219
221
|
# @see Numeric#to_money
|
220
222
|
# @see #from_fixnum
|
221
|
-
# @see #from_float
|
222
223
|
# @see #from_bigdecimal
|
223
224
|
#
|
224
225
|
def from_numeric(value, currency = Money.default_currency)
|
@@ -239,6 +240,7 @@ class Money
|
|
239
240
|
# @return [Integer]
|
240
241
|
#
|
241
242
|
def extract_cents(input, currency = Money.default_currency)
|
243
|
+
Money.deprecate ".extract_cents is depreciated and will be remove in 6.1.0. Please write your own parsing methods."
|
242
244
|
# remove anything that's not a number, potential thousands_separator, or minus sign
|
243
245
|
num = input.gsub(/[^\d.,'-]/, '')
|
244
246
|
|
@@ -362,6 +364,7 @@ class Money
|
|
362
364
|
else
|
363
365
|
minor.to_i
|
364
366
|
end
|
367
|
+
|
365
368
|
cents += minor
|
366
369
|
|
367
370
|
# if negative, multiply by -1; otherwise, return positive cents
|
data/money.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: money
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0.0.
|
4
|
+
version: 6.0.0.pre2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias Luetke
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2013-07-
|
15
|
+
date: 2013-07-27 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: i18n
|