money_with_date 0.1.0 → 0.3.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: 6a911f2070a7b2f664aa55b706b25c60cb2bca163edae6d486fe2453f4195c0b
4
- data.tar.gz: f1622c8bba8fa245391d495172df0fad151670abc1067ae95408078dbc8c7bcf
3
+ metadata.gz: 7821b105830f8b5149853c813849e0682f8d11d0399ee0e4dac4319641dff0d5
4
+ data.tar.gz: c97ae3c5c36d4d699cd9739bb0235c9c15c7265dc57fd53c1822c677eb09511f
5
5
  SHA512:
6
- metadata.gz: bf1e0503e40b67256656889b317f0199fafac3c8486b0764656afd618e063b7de66e91006e40a9e097e17b09e20f3021431d72410d31f25953106ad2f38d317f
7
- data.tar.gz: f511459facf2b7670b6040e0d87a8cea0aa5d6fdf899d7f0e2e89720400ae540a2f7c720a6c023563d9eabc6b3533d69ba11a7807f179355aa4af16a2b17826d
6
+ metadata.gz: 19e7424b1284b3f13ffb4a8f257f72b0a1ca8bfefd06561ffe4165a2d85732c48e39e54305e1f0b04a430cccf3432d827197fa2268ed5b260c9cc888085c4971
7
+ data.tar.gz: eb2d53e6939725cc3e6fa20f2734803395da997fab1fffd52d9f23c88eda73eecc282337465acdb6ad3773af96fc213c5d78f3747c5dddfcdf80210bcb50f7e8
data/.rubocop.yml CHANGED
@@ -6,6 +6,9 @@ AllCops:
6
6
  - 'spec_money_rails/**/*'
7
7
  - 'vendor/**/*'
8
8
 
9
+ Style/AccessorGrouping:
10
+ Enabled: false
11
+
9
12
  Style/StringLiterals:
10
13
  Enabled: true
11
14
  EnforcedStyle: double_quotes
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.3.0] - 2022-09-18
4
+
5
+ - Fix monetizable module specs ([#4](https://github.com/infinum/money_with_date/pull/4))
6
+ - Globalize default_date_column configuration option ([#5](https://github.com/infinum/money_with_date/pull/5))
7
+
8
+ ## [0.2.0] - 2022-09-16
9
+
10
+ - Make the gem work without money-rails ([#2](https://github.com/infinum/money_with_date/pull/2))
11
+ - Update Rails versions in CI workflow ([#3](https://github.com/infinum/money_with_date/pull/3))
12
+
3
13
  ## [0.1.0] - 2022-02-18
4
14
 
5
- - Initial release
15
+ - Initial release ([#1](https://github.com/infinum/money_with_date/pull/1))
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- money_with_date (0.1.0)
4
+ money_with_date (0.2.0)
5
5
  money (>= 6.14.0, <= 6.16.0)
6
6
 
7
7
  GEM
@@ -9,9 +9,9 @@ GEM
9
9
  specs:
10
10
  ast (2.4.2)
11
11
  coderay (1.1.3)
12
- concurrent-ruby (1.1.9)
12
+ concurrent-ruby (1.1.10)
13
13
  diff-lcs (1.5.0)
14
- i18n (1.10.0)
14
+ i18n (1.12.0)
15
15
  concurrent-ruby (~> 1.0)
16
16
  method_source (1.0.0)
17
17
  money (6.16.0)
data/README.md CHANGED
@@ -46,10 +46,10 @@ transactions = [
46
46
  ]
47
47
 
48
48
  transactions.map { |money| money.exchange_to(:eur) }.sum
49
- # => Money.from_amount(4,82, "EUR")
49
+ # => Money.from_amount(4.82, "EUR")
50
50
  # 2 CHF == 1,92 EUR on today's date
51
- # 1 USD = 0,9 EUR on 1/1/2020
52
- # 1,92 + 0,9 + 2 = 4,82
51
+ # 1 USD == 0,9 EUR on 1/1/2020
52
+ # 1,92 + 0,9 + 2 == 4,82
53
53
 
54
54
  # In Rails, a date column can be used to control the date of the Money object:
55
55
  class Product < ActiveRecord::Base
@@ -338,11 +338,11 @@ Money.default_date_column = nil
338
338
 
339
339
  The gem has been tested against all possible combinations of supported Ruby, Rails, money, and money-rails versions:
340
340
  - Ruby: `2.6`, `2.7`, `3.0`, and `3.1`
341
- - Rails: `5.2.6.2`, `6.0.4.6`, `6.1.4.6`, and `7.0.2.2`
341
+ - Rails: `5.2.8.1`, `6.0.6`, `6.1.7`, `7.0.4`
342
342
  - money: `6.14.0`, `6.14.1`, and `6.16.0`
343
343
  - money-rails: `1.15.0`
344
344
 
345
- Note: the gem hasn't been tested on Rails `5.2.6.2` with Rubies `3.0` and `3.1`, and on Rails `7.0.2.2` with Ruby `2.6` as those combinations of versions aren't compatible.
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.
346
346
 
347
347
  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
348
 
@@ -3,6 +3,7 @@
3
3
  module MoneyWithDate
4
4
  module ClassMethods
5
5
  attr_accessor :date_determines_equality
6
+ attr_accessor :default_date_column
6
7
 
7
8
  attr_writer :default_date
8
9
 
@@ -5,12 +5,8 @@ module MoneyWithDate
5
5
  def self.init
6
6
  ::ActiveSupport.on_load(:active_record) do
7
7
  require "money_with_date/active_record/monetizable"
8
- require "money_with_date/active_record/class_methods"
9
8
 
10
9
  ::ActiveRecord::Base.prepend(::MoneyWithDate::ActiveRecord::Monetizable)
11
- ::Money.singleton_class.prepend(::MoneyWithDate::ActiveRecord::ClassMethods)
12
-
13
- ::Money.default_date_column = :created_at
14
10
  end
15
11
  end
16
12
 
@@ -19,7 +19,7 @@ module MoneyWithDate
19
19
  def hash
20
20
  return super unless ::Money.date_determines_equality
21
21
 
22
- [fractional.hash, currency.hash, date.hash].hash
22
+ [fractional.hash, currency.hash, date.hash].hash # rubocop:disable Security/CompoundHash
23
23
  end
24
24
 
25
25
  def inspect
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MoneyWithDate
4
- VERSION = "0.1.0"
4
+ VERSION = "0.3.0"
5
5
 
6
6
  MINIMUM_MONEY_VERSION = "6.14.0"
7
7
  MINIMUM_MONEY_RAILS_VERSION = "1.15.0"
@@ -15,6 +15,7 @@ require_relative "money_with_date/rates_store/memory"
15
15
  # :nocov:
16
16
  ::Money.date_determines_equality = false
17
17
  ::Money.default_date = ::Date.respond_to?(:current) ? -> { ::Date.current } : -> { ::Date.today }
18
+ ::Money.default_date_column = :created_at
18
19
 
19
- require "money_with_date/railtie" if defined?(::Rails::Railtie)
20
+ require "money_with_date/railtie" if defined?(::Rails::Railtie) && defined?(::MoneyRails)
20
21
  # :nocov:
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.1.0
4
+ version: 0.3.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-02-18 00:00:00.000000000 Z
11
+ date: 2022-09-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: money
@@ -132,7 +132,6 @@ files:
132
132
  - README.md
133
133
  - Rakefile
134
134
  - lib/money_with_date.rb
135
- - lib/money_with_date/active_record/class_methods.rb
136
135
  - lib/money_with_date/active_record/monetizable.rb
137
136
  - lib/money_with_date/bank/variable_exchange.rb
138
137
  - lib/money_with_date/class_methods.rb
@@ -165,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
165
164
  - !ruby/object:Gem::Version
166
165
  version: '0'
167
166
  requirements: []
168
- rubygems_version: 3.2.3
167
+ rubygems_version: 3.3.7
169
168
  signing_key:
170
169
  specification_version: 4
171
170
  summary: Extension for the money gem which adds dates to Money objects
@@ -1,9 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module MoneyWithDate
4
- module ActiveRecord
5
- module ClassMethods
6
- attr_accessor :default_date_column
7
- end
8
- end
9
- end