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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 19a3520f2cff5cb626afdfdc78e11fb523ad404dfe43ebe95dcb62f42d4e4a39
4
- data.tar.gz: dcc7d487825b89ae67974aadff50047ae93054a3dfc5f3bfc555eb44b80e60c1
3
+ metadata.gz: 7821b105830f8b5149853c813849e0682f8d11d0399ee0e4dac4319641dff0d5
4
+ data.tar.gz: c97ae3c5c36d4d699cd9739bb0235c9c15c7265dc57fd53c1822c677eb09511f
5
5
  SHA512:
6
- metadata.gz: 45923e5ffc8d54de1296fd6e07d42ff34785509c13a08b223d7d45d8b7f483c35076dfb5a98fdbde054a0c80632a709fc715eb8663c3cc28d20bf2b43161df6b
7
- data.tar.gz: 25660ea4172f74c68ce085708171ae817b6c3fb6715d0cac616c378d1e4f2286d7bbbe3ec1b01f35c1d974903fb69990a465c44007000265f14521e4c81f0084
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,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.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
@@ -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
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MoneyWithDate
4
- VERSION = "0.2.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
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.2.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-16 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
@@ -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