money_with_date 0.2.0 → 0.3.0
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/.rubocop.yml +3 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +3 -3
- data/README.md +3 -3
- data/lib/money_with_date/class_methods.rb +1 -0
- data/lib/money_with_date/hooks.rb +0 -4
- data/lib/money_with_date/version.rb +1 -1
- data/lib/money_with_date.rb +1 -0
- metadata +2 -3
- 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,10 @@
|
|
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
|
+
|
3
8
|
## [0.2.0] - 2022-09-16
|
4
9
|
|
5
10
|
- Make the gem work without money-rails ([#2](https://github.com/infinum/money_with_date/pull/2))
|
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
|
@@ -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
|
|
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
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-09-
|
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
|