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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: baca6fa666461ab6bc9f1e0ebed40d7ae0ac56af88993b5d243d25f1ad9bbad3
4
- data.tar.gz: e54ad7a337df49a298e0e6236ec98d46a902ddd18b62538d395992609eca533b
3
+ metadata.gz: 531ae60785c01288f3c5b6ffe222c86582c49e368770e8ac1dc89bfae675f279
4
+ data.tar.gz: 3fd0d185d01ed315ea0bd5e89f8c923d5d1712ec571041cd678a7749fbf3ab44
5
5
  SHA512:
6
- metadata.gz: eff34626e551613b9dc312caf42698951869333aaf62440551e44eb681a8b2407e0a36ed24b02ba6f6ef03afc68dd1c7b6ac86aa85d3fafb45155f3637b70a04
7
- data.tar.gz: b1d2f0f9228ef185ce8b86d4474a1d53151960d7796619ba53ff19fe0db53a9ad990e3f77f924b59c90cd984d144fb62f2fba56059f9e40dfeb5893f790e84cd
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]]
@@ -873,7 +873,7 @@
873
873
  priority: 1
874
874
  - code: XXX
875
875
  country: null
876
- subunit: 0
876
+ subunit: 4
877
877
  symbol: ¤
878
878
  name: No Currency
879
879
  priority: 0
@@ -991,4 +991,3 @@
991
991
  symbol: SDR
992
992
  name: Special Drawing Rights
993
993
  priority: 0
994
-
@@ -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.
@@ -3,5 +3,5 @@
3
3
  # Root namespace for the Minting library.
4
4
  module Minting
5
5
  # Current version of the Minting gem.
6
- VERSION = '1.8.1'
6
+ VERSION = '1.8.2'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minting
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.1
4
+ version: 1.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gilson Ferraz