money 7.0.0 → 7.0.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +9 -3
- data/lib/money/money/arithmetic.rb +18 -20
- data/lib/money/money/formatter.rb +1 -1
- data/lib/money/version.rb +1 -1
- data/money.gemspec +4 -2
- metadata +23 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b617ca145c64fc7269e5bdc8f3bb64d8c7e18fe081ac568c1b9f897f89e1fee1
|
|
4
|
+
data.tar.gz: 5d5172afa73dfbb249b14e8540de83e469633b50c23f664108b2159d8dc7ec09
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: af420e10767bd715a6126b658bc9f934a0087e4535a2114fbc342b40b7ad9a85d9ebe56d35e00756034f42ed76172fa999134e5aa29132e2612845073ac60d28
|
|
7
|
+
data.tar.gz: 2f8360e47d12a96e58ec590e1b53fbb5b2f3ba870d362151b3a31e17474477aebcc5c9e97c3b5b66c24c4613e00a06a14cb65088a00a03a7e44296c1e35b2545
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://rubymoney.github.io/money/)
|
|
6
6
|
[](https://opensource.org/license/MIT)
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
⚠️ Please read the [upgrade guides](#upgrade-guides) before upgrading to a new major version.
|
|
9
9
|
|
|
10
10
|
If you miss String parsing, check out the new [monetize gem](https://github.com/RubyMoney/monetize).
|
|
11
11
|
|
|
@@ -453,6 +453,12 @@ m = Money.from_cents('123', :gbp) # => #<Money fractional:123 currency:GBP>
|
|
|
453
453
|
m.format(symbol: m.currency.to_s + ' ') # => "GBP 1.23"
|
|
454
454
|
```
|
|
455
455
|
|
|
456
|
+
If you would like to customize currency symbols to avoid ambiguity between currencies, you can:
|
|
457
|
+
|
|
458
|
+
```ruby
|
|
459
|
+
Money::Currency.table[:hkd][:symbol] = 'HK$'
|
|
460
|
+
```
|
|
461
|
+
|
|
456
462
|
## Rounding
|
|
457
463
|
|
|
458
464
|
By default, `Money` objects are rounded to the nearest cent and the additional precision is not preserved:
|
|
@@ -614,7 +620,7 @@ Prior to v6.9.0 heuristic analysis of string input was part of this gem. Since t
|
|
|
614
620
|
|
|
615
621
|
When upgrading between major versions, please refer to the appropriate upgrade guide:
|
|
616
622
|
|
|
617
|
-
-
|
|
618
|
-
-
|
|
623
|
+
- [Upgrading to 7.0](https://github.com/RubyMoney/money/blob/main/UPGRADING-7.0.md) - Guide for migrating from 6.x to 7.0
|
|
624
|
+
- [Upgrading to 6.0](https://github.com/RubyMoney/money/blob/main/UPGRADING-6.0.md) - Guide for upgrading to version 6.0
|
|
619
625
|
|
|
620
626
|
These guides provide detailed information about breaking changes, new features, and step-by-step migration instructions.
|
|
@@ -113,30 +113,28 @@ class Money
|
|
|
113
113
|
fractional < 0
|
|
114
114
|
end
|
|
115
115
|
|
|
116
|
-
#
|
|
117
|
-
#
|
|
118
|
-
#
|
|
119
|
-
#
|
|
116
|
+
# @!method +(other)
|
|
117
|
+
# Returns a new Money object containing the sum of the two operands' monetary
|
|
118
|
+
# values. If +other_money+ has a different currency then its monetary value
|
|
119
|
+
# is automatically exchanged to this object's currency using +exchange_to+.
|
|
120
120
|
#
|
|
121
|
-
#
|
|
121
|
+
# @param [Money] other Other +Money+ object to add.
|
|
122
|
+
# @return [Money]
|
|
122
123
|
#
|
|
123
|
-
#
|
|
124
|
-
#
|
|
125
|
-
|
|
126
|
-
#
|
|
127
|
-
#
|
|
128
|
-
#
|
|
129
|
-
#
|
|
130
|
-
#
|
|
131
|
-
# its monetary value is automatically exchanged to this object's currency
|
|
132
|
-
# using +exchange_to+.
|
|
133
|
-
#
|
|
134
|
-
# @param [Money] other Other +Money+ object to subtract.
|
|
124
|
+
# @example
|
|
125
|
+
# Money.new(100) + Money.new(100) #=> #<Money @fractional=200>
|
|
126
|
+
|
|
127
|
+
# @!method -(other)
|
|
128
|
+
# Returns a new Money object containing the difference between the two
|
|
129
|
+
# operands' monetary values. If +other_money+ has a different currency then
|
|
130
|
+
# its monetary value is automatically exchanged to this object's currency
|
|
131
|
+
# using +exchange_to+.
|
|
135
132
|
#
|
|
136
|
-
#
|
|
133
|
+
# @param [Money] other Other +Money+ object to subtract.
|
|
134
|
+
# @return [Money]
|
|
137
135
|
#
|
|
138
|
-
#
|
|
139
|
-
#
|
|
136
|
+
# @example
|
|
137
|
+
# Money.new(100) - Money.new(99) #=> #<Money @fractional=1>
|
|
140
138
|
[:+, :-].each do |op|
|
|
141
139
|
non_zero_message = lambda do |value|
|
|
142
140
|
"Can't add or subtract a non-zero #{value.class.name} value"
|
|
@@ -32,7 +32,7 @@ class Money
|
|
|
32
32
|
# Money.us_dollar(85).format(with_currency: true) #=> "$0.85 USD"
|
|
33
33
|
#
|
|
34
34
|
# @option rules [Boolean] :rounded_infinite_precision (false) Whether the
|
|
35
|
-
# amount of money should be rounded when using {
|
|
35
|
+
# amount of money should be rounded when using {default_infinite_precision}
|
|
36
36
|
#
|
|
37
37
|
# @example
|
|
38
38
|
# Money.us_dollar(100.1).format #=> "$1.001"
|
data/lib/money/version.rb
CHANGED
data/money.gemspec
CHANGED
|
@@ -21,8 +21,10 @@ Gem::Specification.new do |s|
|
|
|
21
21
|
s.add_development_dependency "bundler"
|
|
22
22
|
s.add_development_dependency "rake"
|
|
23
23
|
s.add_development_dependency "rspec", "~> 3.4"
|
|
24
|
-
|
|
25
|
-
s.add_development_dependency "
|
|
24
|
+
# Documentation
|
|
25
|
+
s.add_development_dependency "yard", "~> 0.9.38"
|
|
26
|
+
s.add_development_dependency "rdoc"
|
|
27
|
+
s.add_development_dependency "redcarpet" unless RUBY_PLATFORM == "java"
|
|
26
28
|
|
|
27
29
|
s.required_ruby_version = '>= 3.1'
|
|
28
30
|
|
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: 7.0.
|
|
4
|
+
version: 7.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Shane Emmons
|
|
@@ -86,28 +86,42 @@ dependencies:
|
|
|
86
86
|
requirements:
|
|
87
87
|
- - "~>"
|
|
88
88
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: 0.9.
|
|
89
|
+
version: 0.9.38
|
|
90
90
|
type: :development
|
|
91
91
|
prerelease: false
|
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
93
|
requirements:
|
|
94
94
|
- - "~>"
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: 0.9.
|
|
96
|
+
version: 0.9.38
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
98
|
+
name: rdoc
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
|
101
|
-
- - "
|
|
101
|
+
- - ">="
|
|
102
102
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: '
|
|
103
|
+
version: '0'
|
|
104
104
|
type: :development
|
|
105
105
|
prerelease: false
|
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
107
|
requirements:
|
|
108
|
-
- - "
|
|
108
|
+
- - ">="
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: '
|
|
110
|
+
version: '0'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: redcarpet
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - ">="
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '0'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0'
|
|
111
125
|
description: A Ruby Library for dealing with money and currency conversion.
|
|
112
126
|
email:
|
|
113
127
|
- shane@emmons.io
|
|
@@ -165,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
165
179
|
- !ruby/object:Gem::Version
|
|
166
180
|
version: '0'
|
|
167
181
|
requirements: []
|
|
168
|
-
rubygems_version:
|
|
182
|
+
rubygems_version: 4.0.0
|
|
169
183
|
specification_version: 4
|
|
170
184
|
summary: A Ruby Library for dealing with money and currency conversion.
|
|
171
185
|
test_files: []
|