money 7.0.0 → 7.0.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: 435fd498ba0ce70e5d0ee2079e0e99d93abc2c17440f7a6cacda1176641b7d3a
4
- data.tar.gz: 81fdc617e20b27d8628ba2f4859fa2fd41a9cbc04c3a44ddf689036b4414f40b
3
+ metadata.gz: cbdcafa7432cc94f273e6d50d820af8e6656707f9a4eb738d8ae694191d8f470
4
+ data.tar.gz: '093235eead41422c4804dcafde91b396c80f1b4c2d269606f2ce6287ad613871'
5
5
  SHA512:
6
- metadata.gz: 9e2ef4767b6d9a50fa7d6eed46570249af8c2e2bade1c8b11aee93d737d1a8c484d74f1aaf837a880e28af8be44b1c5413a5bea854a015b936026032a3070dcd
7
- data.tar.gz: 756de612cdebdb1e4cf3311f460a3f5118fd775a4f1760ad211c4fd6816804cc16f8b4c461bb8a0292031d7b03a22ae0f291844467791fbbc1a9f1bc46519060
6
+ metadata.gz: 87ca3a9c81395fd38474dc8f46ceec7a0484054093f8aed50ff3a1358ea6214851d2fd81b165d68d94e5902e6229ad03debae12dfacab7dd043359d025f15d64
7
+ data.tar.gz: 8b8a0e2a12646b28b1859c226fbe3ef1b534458ec198d3cd51124263624709b7ced902ce9637e5409061ed0eefe3df67a70e159c9281ccd841e2dda1c1a0b4c1
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 7.0.2
6
+
7
+ - Fix `Money::Currency.register` exception when table is not initialized.
8
+
9
+ ## 7.0.1
10
+
11
+ - Re-publishing gem to fix file permissions https://github.com/RubyMoney/money/issues/1170
12
+
5
13
  ## 7.0.0
6
14
 
7
15
  - **Breaking change**: Require Ruby >= 3.1 and i18n ~> 1.9
data/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Inline docs](https://img.shields.io/badge/docs-github.io-green.svg)](https://rubymoney.github.io/money/)
6
6
  [![License](https://img.shields.io/github/license/RubyMoney/money.svg)](https://opensource.org/license/MIT)
7
7
 
8
- :warning: Please read the [upgrade guides](#upgrade-guides) before upgrading to a new major version.
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
- - **[Upgrading to 7.0](UPGRADING-7.0.md)** - Guide for migrating from 6.x to 7.0
618
- - **[Upgrading to 6.0](UPGRADING-6.0.md)** - Guide for upgrading to version 6.0
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.
@@ -173,7 +173,7 @@ class Money
173
173
  def register(curr)
174
174
  key = curr.fetch(:iso_code).downcase.to_sym
175
175
  @@mutex.synchronize { _instances.delete(key.to_s) }
176
- @table[key] = curr
176
+ table[key] = curr
177
177
  @stringified_keys = nil
178
178
  clear_iso_numeric_cache
179
179
  end
@@ -184,7 +184,7 @@ class Money
184
184
  # @param curr [Hash] See {register} method for hash structure
185
185
  def inherit(parent_iso_code, curr)
186
186
  parent_iso_code = parent_iso_code.downcase.to_sym
187
- curr = @table.fetch(parent_iso_code, {}).merge(curr)
187
+ curr = table.fetch(parent_iso_code, {}).merge(curr)
188
188
  register(curr)
189
189
  end
190
190
 
@@ -113,30 +113,28 @@ class Money
113
113
  fractional < 0
114
114
  end
115
115
 
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+.
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
- # @param [Money] other Other +Money+ object to add.
121
+ # @param [Money] other Other +Money+ object to add.
122
+ # @return [Money]
122
123
  #
123
- # @return [Money]
124
- #
125
- # @example
126
- # Money.new(100) + Money.new(100) #=> #<Money @fractional=200>
127
- #
128
- # @method -(other)
129
- # Returns a new Money object containing the difference between the two
130
- # operands' monetary values. If +other_money+ has a different currency then
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
- # @return [Money]
133
+ # @param [Money] other Other +Money+ object to subtract.
134
+ # @return [Money]
137
135
  #
138
- # @example
139
- # Money.new(100) - Money.new(99) #=> #<Money @fractional=1>
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 {infinite_precision}
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class Money
4
- VERSION = '7.0.0'.freeze
4
+ VERSION = "7.0.2"
5
5
  end
data/money.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path('../lib', __FILE__)
3
+ lib = File.expand_path("lib", __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require "money/version"
6
6
 
@@ -16,15 +16,9 @@ Gem::Specification.new do |s|
16
16
  s.license = "MIT"
17
17
 
18
18
  s.add_dependency "bigdecimal"
19
- s.add_dependency 'i18n', "~> 1.9"
19
+ s.add_dependency "i18n", "~> 1.9"
20
20
 
21
- s.add_development_dependency "bundler"
22
- s.add_development_dependency "rake"
23
- s.add_development_dependency "rspec", "~> 3.4"
24
- s.add_development_dependency "yard", "~> 0.9.11"
25
- s.add_development_dependency "kramdown", "~> 2.3"
26
-
27
- s.required_ruby_version = '>= 3.1'
21
+ s.required_ruby_version = ">= 3.1"
28
22
 
29
23
  s.files = `git ls-files -z -- config/* lib/* CHANGELOG.md LICENSE money.gemspec README.md`.split("\x0")
30
24
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: money
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.0
4
+ version: 7.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shane Emmons
8
8
  - Anthony Dmitriyev
9
+ autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 1980-01-02 00:00:00.000000000 Z
12
+ date: 2025-12-10 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: bigdecimal
@@ -38,76 +39,6 @@ dependencies:
38
39
  - - "~>"
39
40
  - !ruby/object:Gem::Version
40
41
  version: '1.9'
41
- - !ruby/object:Gem::Dependency
42
- name: bundler
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rake
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rspec
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '3.4'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '3.4'
83
- - !ruby/object:Gem::Dependency
84
- name: yard
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: 0.9.11
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: 0.9.11
97
- - !ruby/object:Gem::Dependency
98
- name: kramdown
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '2.3'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '2.3'
111
42
  description: A Ruby Library for dealing with money and currency conversion.
112
43
  email:
113
44
  - shane@emmons.io
@@ -151,6 +82,7 @@ metadata:
151
82
  source_code_uri: https://github.com/RubyMoney/money/
152
83
  bug_tracker_uri: https://github.com/RubyMoney/money/issues
153
84
  rubygems_mfa_required: 'true'
85
+ post_install_message:
154
86
  rdoc_options: []
155
87
  require_paths:
156
88
  - lib
@@ -165,7 +97,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
97
  - !ruby/object:Gem::Version
166
98
  version: '0'
167
99
  requirements: []
168
- rubygems_version: 3.6.9
100
+ rubygems_version: 3.5.22
101
+ signing_key:
169
102
  specification_version: 4
170
103
  summary: A Ruby Library for dealing with money and currency conversion.
171
104
  test_files: []