aggregate_root 2.1.0 → 2.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: 506e445ebb792e32a773f2ac2e8e23f414209d3782a374195d2d999cf7f3a7df
4
- data.tar.gz: d5877ac859dfabb7f1f873d5ffcb6f8c664e34fb69ee2d6846ce184a65d2fdbf
3
+ metadata.gz: 30ff98d2282add92ff95eca80c76a3b12f119bb0c4659bb9093f71500290bf49
4
+ data.tar.gz: 379cf4fdb8b8850fd3b0307406bc0e67046d7ec34ded9a9d86d208bdff400564
5
5
  SHA512:
6
- metadata.gz: 2941c2036decd322cbcac7448fe4cd5aaf34b838faf11c2fe2969d1681d5f5a506feef03e9f4c40b25a7b08d76264d165f7cbdb49ad000d4e11e2865a4a81e9e
7
- data.tar.gz: d764ea6bd1d8bf91452202990f353d95305edb13e0f37378aad86e6f64f2ca402a2d9f52aa2c5a6c5b6c44e56264bf99b2cb524f3215954755011a17b493fd32
6
+ metadata.gz: 51321bc327a382249bb120094df57d864020c358f95d7350c86ed13fa3c8faf85ca7f92cb70cca346cebe5de88d2a5e6cd6cccbec38371b044fc655e131e2521
7
+ data.tar.gz: d49549c5b59eed7de2e5312af1ccc30707a55e15a799d3f30c67acc748c5690f61301e18faac5c8421ca34521bbb7bf3eeff06d99ee22e30de68d9f9426f95d6
@@ -32,7 +32,7 @@ module AggregateRoot
32
32
  end
33
33
 
34
34
  def event_type(event_type)
35
- event_type.split(%r{::|\.}).last
35
+ event_type.split(/::|\./).last
36
36
  end
37
37
 
38
38
  attr_reader :strict, :on_methods
@@ -8,21 +8,19 @@ module AggregateRoot
8
8
  end
9
9
 
10
10
  def load(aggregate, stream_name)
11
- instrumentation.instrument("load.repository.aggregate_root",
12
- aggregate: aggregate,
13
- stream: stream_name) do
11
+ instrumentation.instrument("load.repository.aggregate_root", aggregate: aggregate, stream: stream_name) do
14
12
  repository.load(aggregate, stream_name)
15
13
  end
16
14
  end
17
15
 
18
16
  def store(aggregate, stream_name)
19
- instrumentation.instrument("store.repository.aggregate_root",
20
- aggregate: aggregate,
21
- version: aggregate.version,
17
+ instrumentation.instrument(
18
+ "store.repository.aggregate_root",
19
+ aggregate: aggregate,
20
+ version: aggregate.version,
22
21
  stored_events: aggregate.unpublished_events.to_a,
23
- stream: stream_name) do
24
- repository.store(aggregate, stream_name)
25
- end
22
+ stream: stream_name
23
+ ) { repository.store(aggregate, stream_name) }
26
24
  end
27
25
 
28
26
  def with_aggregate(aggregate, stream_name, &block)
@@ -30,6 +28,18 @@ module AggregateRoot
30
28
  store(aggregate, stream_name)
31
29
  end
32
30
 
31
+ def method_missing(method_name, *arguments, **keyword_arguments, &block)
32
+ if respond_to?(method_name)
33
+ repository.public_send(method_name, *arguments, **keyword_arguments, &block)
34
+ else
35
+ super
36
+ end
37
+ end
38
+
39
+ def respond_to_missing?(method_name, _include_private)
40
+ repository.respond_to?(method_name)
41
+ end
42
+
33
43
  private
34
44
 
35
45
  attr_reader :instrumentation, :repository
@@ -13,9 +13,11 @@ module AggregateRoot
13
13
  end
14
14
 
15
15
  def store(aggregate, stream_name)
16
- event_store.publish(aggregate.unpublished_events.to_a,
17
- stream_name: stream_name,
18
- expected_version: aggregate.version)
16
+ event_store.publish(
17
+ aggregate.unpublished_events.to_a,
18
+ stream_name: stream_name,
19
+ expected_version: aggregate.version
20
+ )
19
21
  aggregate.version = aggregate.version + aggregate.unpublished_events.count
20
22
  end
21
23
 
@@ -3,10 +3,7 @@
3
3
  module AggregateRoot
4
4
  class Transform
5
5
  def self.to_snake_case(name)
6
- name
7
- .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
8
- .gsub(/([a-z\d])([A-Z])/, '\1_\2')
9
- .downcase
6
+ name.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2').gsub(/([a-z\d])([A-Z])/, '\1_\2').downcase
10
7
  end
11
8
  end
12
9
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AggregateRoot
4
- VERSION = "2.1.0"
4
+ VERSION = "2.4.0"
5
5
  end
@@ -1,12 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'aggregate_root/version'
4
- require 'aggregate_root/configuration'
5
- require 'aggregate_root/transform'
6
- require 'aggregate_root/default_apply_strategy'
7
- require 'aggregate_root/repository'
8
- require 'aggregate_root/instrumented_repository'
9
- require 'ruby2_keywords'
3
+ require_relative "aggregate_root/version"
4
+ require_relative "aggregate_root/configuration"
5
+ require_relative "aggregate_root/transform"
6
+ require_relative "aggregate_root/default_apply_strategy"
7
+ require_relative "aggregate_root/repository"
8
+ require_relative "aggregate_root/instrumented_repository"
10
9
 
11
10
  module AggregateRoot
12
11
  module OnDSL
@@ -32,7 +31,7 @@ module AggregateRoot
32
31
  end
33
32
 
34
33
  module Constructor
35
- ruby2_keywords def new(*)
34
+ def new(*, **)
36
35
  super.tap do |instance|
37
36
  instance.instance_variable_set(:@version, -1)
38
37
  instance.instance_variable_set(:@unpublished_events, [])
@@ -65,8 +64,8 @@ module AggregateRoot
65
64
  def self.with_default_apply_strategy
66
65
  Module.new do
67
66
  def self.included(host_class)
68
- host_class.extend OnDSL
69
- host_class.include AggregateRoot.with_strategy(->{ DefaultApplyStrategy.new })
67
+ host_class.extend OnDSL
68
+ host_class.include AggregateRoot.with_strategy(-> { DefaultApplyStrategy.new })
70
69
  end
71
70
  end
72
71
  end
@@ -74,7 +73,7 @@ module AggregateRoot
74
73
  def self.with_strategy(strategy)
75
74
  Module.new do
76
75
  def self.included(host_class)
77
- host_class.extend Constructor
76
+ host_class.extend Constructor
78
77
  host_class.include AggregateMethods
79
78
  end
80
79
 
metadata CHANGED
@@ -1,43 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aggregate_root
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arkency
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-01-07 00:00:00.000000000 Z
11
+ date: 2022-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: ruby2_keywords
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: ruby_event_store
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - '='
32
18
  - !ruby/object:Gem::Version
33
- version: 2.1.0
19
+ version: 2.4.0
34
20
  type: :runtime
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - '='
39
25
  - !ruby/object:Gem::Version
40
- version: 2.1.0
26
+ version: 2.4.0
41
27
  description:
42
28
  email: dev@arkency.com
43
29
  executables: []
@@ -61,6 +47,7 @@ metadata:
61
47
  changelog_uri: https://github.com/RailsEventStore/rails_event_store/releases
62
48
  source_code_uri: https://github.com/RailsEventStore/rails_event_store
63
49
  bug_tracker_uri: https://github.com/RailsEventStore/rails_event_store/issues
50
+ rubygems_mfa_required: 'true'
64
51
  post_install_message:
65
52
  rdoc_options: []
66
53
  require_paths:
@@ -69,14 +56,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
69
56
  requirements:
70
57
  - - ">="
71
58
  - !ruby/object:Gem::Version
72
- version: '2.5'
59
+ version: '2.7'
73
60
  required_rubygems_version: !ruby/object:Gem::Requirement
74
61
  requirements:
75
62
  - - ">="
76
63
  - !ruby/object:Gem::Version
77
64
  version: '0'
78
65
  requirements: []
79
- rubygems_version: 3.1.4
66
+ rubygems_version: 3.3.7
80
67
  signing_key:
81
68
  specification_version: 4
82
69
  summary: Event sourced aggregate root implementation for RubyEventStore