minting 1.8.1 → 1.8.2
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/README.md +6 -0
- data/lib/minting/data/world-currencies.yaml +1 -2
- data/lib/minting/money/constructors.rb +9 -0
- data/lib/minting/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 531ae60785c01288f3c5b6ffe222c86582c49e368770e8ac1dc89bfae675f279
|
|
4
|
+
data.tar.gz: 3fd0d185d01ed315ea0bd5e89f8c923d5d1712ec571041cd678a7749fbf3ab44
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e0799f5c93aac8f065d1b213e848d4ec650278b93e475431ca7c6f71cc69cece2525c51fa4b7d2a54e6317f27befb68cfbf362b3c74960ce51a962cd0178d86c
|
|
7
|
+
data.tar.gz: ae2121c6b9d7115b3ef40dbef4761ac0257cfea1770141543c87c741c0c49f8e5d60ef95970042dffe895ec948cc5c1dbf6ccf644aa34f401407003303c10744
|
data/README.md
CHANGED
|
@@ -121,6 +121,12 @@ Mint::Money.from_fractional(999, 'USD') #=> [USD 9.99]
|
|
|
121
121
|
Mint::Money.from_fractional(1234, 'JPY') #=> [JPY 1234] # subunit 0 -> no scaling
|
|
122
122
|
|
|
123
123
|
|
|
124
|
+
# No currency (ISO 4217 XXX)
|
|
125
|
+
|
|
126
|
+
Mint::Money.no_currency(100) #=> [XXX 100]
|
|
127
|
+
Mint::Money.no_currency(0) #=> [XXX 0]
|
|
128
|
+
|
|
129
|
+
|
|
124
130
|
# Proportional allocation and split
|
|
125
131
|
|
|
126
132
|
ten.split(3) #=> [[USD 3.34], [USD 3.33], [USD 3.33]]
|
|
@@ -16,6 +16,15 @@ module Mint
|
|
|
16
16
|
amount.zero? ? currency.zero : new(amount, currency)
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
+
# Creates a new Money without a currency (ISO 4217 XXX — "No Currency").
|
|
20
|
+
#
|
|
21
|
+
# @param amount [Numeric] The monetary amount
|
|
22
|
+
# @return [Money] a Money instance with the XXX currency
|
|
23
|
+
# @raise [ArgumentError] If amount is not numeric
|
|
24
|
+
# @example
|
|
25
|
+
# Money.no_currency(100) #=> [XXX 100]
|
|
26
|
+
def self.no_currency(amount) = from(amount, 'XXX')
|
|
27
|
+
|
|
19
28
|
# Parses a human-readable money string into a {Money} object.
|
|
20
29
|
#
|
|
21
30
|
# Returns +nil+ when the input is invalid or currency cannot be determined.
|
data/lib/minting/version.rb
CHANGED