money_with_date 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7821b105830f8b5149853c813849e0682f8d11d0399ee0e4dac4319641dff0d5
4
- data.tar.gz: c97ae3c5c36d4d699cd9739bb0235c9c15c7265dc57fd53c1822c677eb09511f
3
+ metadata.gz: 5ea5e9735d420c5bc644d12c9c27621c2c0d6a16c42108ba93460af3542a33bc
4
+ data.tar.gz: 56ca079c22121b3fcc7fcb4c0000aea97e590bcb4487403b9d474eb92a833e8f
5
5
  SHA512:
6
- metadata.gz: 19e7424b1284b3f13ffb4a8f257f72b0a1ca8bfefd06561ffe4165a2d85732c48e39e54305e1f0b04a430cccf3432d827197fa2268ed5b260c9cc888085c4971
7
- data.tar.gz: eb2d53e6939725cc3e6fa20f2734803395da997fab1fffd52d9f23c88eda73eecc282337465acdb6ad3773af96fc213c5d78f3747c5dddfcdf80210bcb50f7e8
6
+ metadata.gz: 49da9ee683e362ac6fb444b92133d9a2de229536bcc65c29a74dff5e15da30c9cc490f975770f14586a9400f52c738c5548b0e41514f64432c82054c8cfd547c
7
+ data.tar.gz: 580056af02a78f82a027bad22ac8baede08e9623bb4f935637170e5d9d39af0f93731ce643f31df5dfa7798c4ffb423eae9b41510ac0b7a73f0715f5273e03e0
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.6
2
+ TargetRubyVersion: 3.0
3
3
  NewCops: enable
4
4
  Exclude:
5
5
  - 'spec_money/**/*'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.0] - 2024-09-06
4
+
5
+ - Update supported versions ([#7](https://github.com/infinum/money_with_date/pull/7))
6
+
7
+ **Breaking**: drops support for Ruby 2.6 and 2.7, and Rails 5.2 and 6.0.
8
+
3
9
  ## [0.3.0] - 2022-09-18
4
10
 
5
11
  - Fix monetizable module specs ([#4](https://github.com/infinum/money_with_date/pull/4))
data/Gemfile.lock CHANGED
@@ -1,61 +1,65 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- money_with_date (0.2.0)
5
- money (>= 6.14.0, <= 6.16.0)
4
+ money_with_date (0.4.0)
5
+ money (>= 6.14.0, <= 6.19.0)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  ast (2.4.2)
11
11
  coderay (1.1.3)
12
- concurrent-ruby (1.1.10)
13
- diff-lcs (1.5.0)
14
- i18n (1.12.0)
12
+ concurrent-ruby (1.3.4)
13
+ diff-lcs (1.5.1)
14
+ i18n (1.14.5)
15
15
  concurrent-ruby (~> 1.0)
16
- method_source (1.0.0)
17
- money (6.16.0)
16
+ json (2.7.2)
17
+ language_server-protocol (3.17.0.3)
18
+ method_source (1.1.0)
19
+ money (6.19.0)
18
20
  i18n (>= 0.6.4, <= 2)
19
- parallel (1.21.0)
20
- parser (3.1.0.0)
21
+ parallel (1.26.3)
22
+ parser (3.3.5.0)
21
23
  ast (~> 2.4.1)
22
- pry (0.14.1)
24
+ racc
25
+ pry (0.14.2)
23
26
  coderay (~> 1.1)
24
27
  method_source (~> 1.0)
28
+ racc (1.8.1)
25
29
  rainbow (3.1.1)
26
- rake (13.0.6)
27
- regexp_parser (2.2.1)
28
- rexml (3.2.5)
29
- rspec (3.11.0)
30
- rspec-core (~> 3.11.0)
31
- rspec-expectations (~> 3.11.0)
32
- rspec-mocks (~> 3.11.0)
33
- rspec-core (3.11.0)
34
- rspec-support (~> 3.11.0)
35
- rspec-expectations (3.11.0)
30
+ rake (13.2.1)
31
+ regexp_parser (2.9.2)
32
+ rspec (3.13.0)
33
+ rspec-core (~> 3.13.0)
34
+ rspec-expectations (~> 3.13.0)
35
+ rspec-mocks (~> 3.13.0)
36
+ rspec-core (3.13.1)
37
+ rspec-support (~> 3.13.0)
38
+ rspec-expectations (3.13.2)
36
39
  diff-lcs (>= 1.2.0, < 2.0)
37
- rspec-support (~> 3.11.0)
38
- rspec-mocks (3.11.0)
40
+ rspec-support (~> 3.13.0)
41
+ rspec-mocks (3.13.1)
39
42
  diff-lcs (>= 1.2.0, < 2.0)
40
- rspec-support (~> 3.11.0)
41
- rspec-support (3.11.0)
42
- rubocop (1.25.1)
43
+ rspec-support (~> 3.13.0)
44
+ rspec-support (3.13.1)
45
+ rubocop (1.66.1)
46
+ json (~> 2.3)
47
+ language_server-protocol (>= 3.17.0)
43
48
  parallel (~> 1.10)
44
- parser (>= 3.1.0.0)
49
+ parser (>= 3.3.0.2)
45
50
  rainbow (>= 2.2.2, < 4.0)
46
- regexp_parser (>= 1.8, < 3.0)
47
- rexml
48
- rubocop-ast (>= 1.15.1, < 2.0)
51
+ regexp_parser (>= 2.4, < 3.0)
52
+ rubocop-ast (>= 1.32.2, < 2.0)
49
53
  ruby-progressbar (~> 1.7)
50
- unicode-display_width (>= 1.4.0, < 3.0)
51
- rubocop-ast (1.15.2)
52
- parser (>= 3.0.1.1)
54
+ unicode-display_width (>= 2.4.0, < 3.0)
55
+ rubocop-ast (1.32.3)
56
+ parser (>= 3.3.1.0)
53
57
  rubocop-rake (0.6.0)
54
58
  rubocop (~> 1.0)
55
- rubocop-rspec (2.8.0)
56
- rubocop (~> 1.19)
57
- ruby-progressbar (1.11.0)
58
- unicode-display_width (2.1.0)
59
+ rubocop-rspec (3.0.4)
60
+ rubocop (~> 1.61)
61
+ ruby-progressbar (1.13.0)
62
+ unicode-display_width (2.5.0)
59
63
 
60
64
  PLATFORMS
61
65
  ruby
@@ -70,4 +74,4 @@ DEPENDENCIES
70
74
  rubocop-rspec
71
75
 
72
76
  BUNDLED WITH
73
- 2.3.7
77
+ 2.5.18
data/Gemfile_test CHANGED
@@ -4,9 +4,17 @@ source "https://rubygems.org"
4
4
 
5
5
  gemspec
6
6
 
7
- gem "money", ENV["MONEY_VERSION"]
8
- gem "money-rails", ENV["MONEY_RAILS_VERSION"]
9
- gem "activerecord", ENV["RAILS_VERSION"]
10
- gem "sqlite3"
7
+ gem "money", ENV["MONEY_VERSION"] if ENV["MONEY_VERSION"]
8
+ gem "money-rails", ENV["MONEY_RAILS_VERSION"] if ENV["MONEY_RAILS_VERSION"]
9
+ gem "activerecord", ENV["RAILS_VERSION"] if ENV["RAILS_VERSION"]
10
+
11
+ if ENV["RAILS_VERSION"]
12
+ if Gem::Version.new(ENV.fetch("RAILS_VERSION").delete_prefix("~> ")) >= Gem::Version.new("7.1.0")
13
+ gem "sqlite3"
14
+ else
15
+ gem "sqlite3", "~> 1.4"
16
+ end
17
+ end
18
+
11
19
  gem "rubyzip"
12
20
  gem "simplecov", require: false
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  A Ruby library which extends the popular [money](https://github.com/RubyMoney/money) and [money-rails](https://github.com/RubyMoney/money-rails) gems with support for dated Money objects.
4
4
 
5
- Dated Money objects are useful in situations where you have to exchange money between currencies based on historical exchange rates, and you'd like to keep date information on the Money object itself.
5
+ Dated Money objects are useful in situations where you have to exchange money between currencies based on historical exchange rates, and you'd like to keep date information on the Money object itself.
6
6
 
7
7
  ## Installation
8
8
 
@@ -332,17 +332,18 @@ Money.default_date_column = nil
332
332
  ## Supported Versions
333
333
 
334
334
  `money_with_date` has the following version requirements:
335
- - Ruby: **>= 2.6.0**
336
- - money: **>= 6.14.0** and **<= 6.16.0**
335
+ - Ruby: **>= 3.0.0**
336
+ - money: **>= 6.14.0** and **<= 6.19.0**
337
337
  - money-rails: **1.15.0**
338
338
 
339
339
  The gem has been tested against all possible combinations of supported Ruby, Rails, money, and money-rails versions:
340
- - Ruby: `2.6`, `2.7`, `3.0`, and `3.1`
341
- - Rails: `5.2.8.1`, `6.0.6`, `6.1.7`, `7.0.4`
342
- - money: `6.14.0`, `6.14.1`, and `6.16.0`
340
+ - Ruby: `3.0`, `3.1`, `3.2` and `3.3`
341
+ - Rails: `~> 6.1.0`, `~> 7.0.0`, `~> 7.1.0` and `~> 7.2.0`
342
+ - money: `6.14.0`, `6.14.1`, `6.16.0`, `6.17.0`, `6.18.0` and `6.19.0`
343
343
  - money-rails: `1.15.0`
344
344
 
345
- Note: the gem hasn't been tested on Rails `5.2.8.1` with Rubies `3.0` and `3.1`, and on Rails `7.0.4` with Ruby `2.6` as those combinations of versions aren't compatible.
345
+ The following combinations have been excluded from the test matrix because of incompatibility:
346
+ - Ruby `3.0` with Rails `~> 7.2.0`
346
347
 
347
348
  In addition to running its own test suite, the CI for this gem also runs [money's](https://github.com/RubyMoney/money/tree/main/spec) and [money-rails's](https://github.com/RubyMoney/money-rails/tree/main/spec) test suites with this gem loaded, to prevent regressions. This has been achieved by cloning their test suites from GitHub and requiring this gem in their spec files. For technical information, check the CI [workflow](.github/workflows/ci.yml).
348
349
 
@@ -4,7 +4,7 @@ module MoneyWithDate
4
4
  module ActiveRecord
5
5
  module Monetizable
6
6
  def read_monetized(name, subunit_name, options = {}, *args)
7
- money = super(name, subunit_name, options, *args)
7
+ money = super
8
8
  date = find_date_for(options[:with_model_date], options[:with_date])
9
9
 
10
10
  if money&.date == date
@@ -54,7 +54,7 @@ module MoneyWithDate
54
54
  def rates
55
55
  return super if store.method(:get_rate).parameters.size == 2
56
56
 
57
- store.each_rate.each_with_object({}) do |(from, to, rate, date), hash|
57
+ store.each_rate.with_object({}) do |(from, to, rate, date), hash|
58
58
  hash[date.to_s] ||= {}
59
59
  hash[date.to_s][[from, to].join(SERIALIZER_SEPARATOR)] = rate
60
60
  end
@@ -1,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MoneyWithDate
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
 
6
6
  MINIMUM_MONEY_VERSION = "6.14.0"
7
7
  MINIMUM_MONEY_RAILS_VERSION = "1.15.0"
8
8
 
9
- MAXIMUM_MONEY_VERSION = "6.16.0"
9
+ MAXIMUM_MONEY_VERSION = "6.19.0"
10
10
  MAXIMUM_MONEY_RAILS_VERSION = "1.15.0"
11
11
  end
@@ -9,13 +9,13 @@ require_relative "money_with_date/instance_methods"
9
9
  require_relative "money_with_date/bank/variable_exchange"
10
10
  require_relative "money_with_date/rates_store/memory"
11
11
 
12
- ::Money.prepend(::MoneyWithDate::InstanceMethods)
13
- ::Money.singleton_class.prepend(::MoneyWithDate::ClassMethods)
12
+ Money.prepend(MoneyWithDate::InstanceMethods)
13
+ Money.singleton_class.prepend(MoneyWithDate::ClassMethods)
14
14
 
15
15
  # :nocov:
16
- ::Money.date_determines_equality = false
17
- ::Money.default_date = ::Date.respond_to?(:current) ? -> { ::Date.current } : -> { ::Date.today }
18
- ::Money.default_date_column = :created_at
16
+ Money.date_determines_equality = false
17
+ Money.default_date = Date.respond_to?(:current) ? -> { Date.current } : -> { Date.today }
18
+ Money.default_date_column = :created_at
19
19
 
20
- require "money_with_date/railtie" if defined?(::Rails::Railtie) && defined?(::MoneyRails)
20
+ require "money_with_date/railtie" if defined?(Rails::Railtie) && defined?(MoneyRails)
21
21
  # :nocov:
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = "Extension for the money gem which adds dates to Money objects"
12
12
  spec.homepage = "https://github.com/infinum/money_with_date"
13
13
  spec.license = "MIT"
14
- spec.required_ruby_version = ">= 2.6.0"
14
+ spec.required_ruby_version = ">= 3.0.0"
15
15
 
16
16
  spec.metadata["homepage_uri"] = spec.homepage
17
17
  spec.metadata["source_code_uri"] = spec.homepage
@@ -30,10 +30,12 @@ Gem::Specification.new do |spec|
30
30
 
31
31
  spec.add_dependency "money", ">= #{MoneyWithDate::MINIMUM_MONEY_VERSION}", "<= #{MoneyWithDate::MAXIMUM_MONEY_VERSION}" # rubocop:disable Layout/LineLength
32
32
 
33
+ # rubocop:disable Gemspec/DevelopmentDependencies
33
34
  spec.add_development_dependency "pry"
34
35
  spec.add_development_dependency "rake"
35
36
  spec.add_development_dependency "rspec"
36
37
  spec.add_development_dependency "rubocop"
37
38
  spec.add_development_dependency "rubocop-rake"
38
39
  spec.add_development_dependency "rubocop-rspec"
40
+ # rubocop:enable all
39
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: money_with_date
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lovro Bikić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-18 00:00:00.000000000 Z
11
+ date: 2024-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: money
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 6.14.0
20
20
  - - "<="
21
21
  - !ruby/object:Gem::Version
22
- version: 6.16.0
22
+ version: 6.19.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 6.14.0
30
30
  - - "<="
31
31
  - !ruby/object:Gem::Version
32
- version: 6.16.0
32
+ version: 6.19.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: pry
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -157,14 +157,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
157
157
  requirements:
158
158
  - - ">="
159
159
  - !ruby/object:Gem::Version
160
- version: 2.6.0
160
+ version: 3.0.0
161
161
  required_rubygems_version: !ruby/object:Gem::Requirement
162
162
  requirements:
163
163
  - - ">="
164
164
  - !ruby/object:Gem::Version
165
165
  version: '0'
166
166
  requirements: []
167
- rubygems_version: 3.3.7
167
+ rubygems_version: 3.5.11
168
168
  signing_key:
169
169
  specification_version: 4
170
170
  summary: Extension for the money gem which adds dates to Money objects