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 +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +11 -1
- data/Gemfile.lock +3 -3
- data/README.md +5 -5
- data/lib/money_with_date/class_methods.rb +1 -0
- data/lib/money_with_date/hooks.rb +0 -4
- data/lib/money_with_date/instance_methods.rb +1 -1
- data/lib/money_with_date/version.rb +1 -1
- data/lib/money_with_date.rb +2 -1
- metadata +3 -4
- data/lib/money_with_date/active_record/class_methods.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7821b105830f8b5149853c813849e0682f8d11d0399ee0e4dac4319641dff0d5
|
4
|
+
data.tar.gz: c97ae3c5c36d4d699cd9739bb0235c9c15c7265dc57fd53c1822c677eb09511f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19e7424b1284b3f13ffb4a8f257f72b0a1ca8bfefd06561ffe4165a2d85732c48e39e54305e1f0b04a430cccf3432d827197fa2268ed5b260c9cc888085c4971
|
7
|
+
data.tar.gz: eb2d53e6939725cc3e6fa20f2734803395da997fab1fffd52d9f23c88eda73eecc282337465acdb6ad3773af96fc213c5d78f3747c5dddfcdf80210bcb50f7e8
|
data/.rubocop.yml
CHANGED
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.
|
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.
|
12
|
+
concurrent-ruby (1.1.10)
|
13
13
|
diff-lcs (1.5.0)
|
14
|
-
i18n (1.
|
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
|
49
|
+
# => Money.from_amount(4.82, "EUR")
|
50
50
|
# 2 CHF == 1,92 EUR on today's date
|
51
|
-
# 1 USD
|
52
|
-
# 1,92 + 0,9 + 2
|
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.
|
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.
|
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
|
|
@@ -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
|
data/lib/money_with_date.rb
CHANGED
@@ -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.
|
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-
|
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.
|
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
|