aggregate_root 2.3.0 → 2.5.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: 811616d804ab21b7d63202052384fe92be04dc24c24ebbd866b26ed83930b8e6
4
- data.tar.gz: 7b2c17d75250a0d82f7d4ced5f2e653647b0110302a2122a6c251dbc7573b0dd
3
+ metadata.gz: ee4e8db0546a34185ea8effc95e059e6381388057df35c3205031c14ba7949b1
4
+ data.tar.gz: d8bcfc814623da1551885dcec806e303f653a1a9b5f8adbe7ccc347760074b0f
5
5
  SHA512:
6
- metadata.gz: 0bb37ed61a36cc20e8c39ff7405d75dea61cf434ed42e22d802503e62a3380e916a2c7dd1b066ea3009b5fd945e8241bcd28484e10da98a3718b0a3f3df10d74
7
- data.tar.gz: d70280a5974bda03ca308f16c8d5d344c15dcaa3cecd209e9d250f36d14861999eaa997ae90a2138247cb1c2c18c106b1d2b14abab2f2d6e0763f47526f001d9
6
+ metadata.gz: c57ed90497b193a5a9233d0053365f4ab29036330f03c681a0dbcaa88fd92e80e6e9d14ca41eff2579934a6b9852ae66b46d98307e53612e13fa84b7dde83feb
7
+ data.tar.gz: ac289f85146e8bfe1c8ca84e3f5330805d773fd16be7c5d75fcb95449baa3f3fae9bab2fb7993844e9a9a47512d1081c9cb95d9c7c9b231136c1833ea9f42073
@@ -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
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "ruby2_keywords"
4
-
5
3
  module AggregateRoot
6
4
  class InstrumentedRepository
7
5
  def initialize(repository, instrumentation)
@@ -10,21 +8,19 @@ module AggregateRoot
10
8
  end
11
9
 
12
10
  def load(aggregate, stream_name)
13
- instrumentation.instrument("load.repository.aggregate_root",
14
- aggregate: aggregate,
15
- stream: stream_name) do
11
+ instrumentation.instrument("load.repository.aggregate_root", aggregate: aggregate, stream: stream_name) do
16
12
  repository.load(aggregate, stream_name)
17
13
  end
18
14
  end
19
15
 
20
16
  def store(aggregate, stream_name)
21
- instrumentation.instrument("store.repository.aggregate_root",
22
- aggregate: aggregate,
23
- version: aggregate.version,
17
+ instrumentation.instrument(
18
+ "store.repository.aggregate_root",
19
+ aggregate: aggregate,
20
+ version: aggregate.version,
24
21
  stored_events: aggregate.unpublished_events.to_a,
25
- stream: stream_name) do
26
- repository.store(aggregate, stream_name)
27
- end
22
+ stream: stream_name
23
+ ) { repository.store(aggregate, stream_name) }
28
24
  end
29
25
 
30
26
  def with_aggregate(aggregate, stream_name, &block)
@@ -32,9 +28,9 @@ module AggregateRoot
32
28
  store(aggregate, stream_name)
33
29
  end
34
30
 
35
- ruby2_keywords def method_missing(method_name, *arguments, &block)
31
+ def method_missing(method_name, *arguments, **keyword_arguments, &block)
36
32
  if respond_to?(method_name)
37
- repository.public_send(method_name, *arguments, &block)
33
+ repository.public_send(method_name, *arguments, **keyword_arguments, &block)
38
34
  else
39
35
  super
40
36
  end
@@ -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.3.0"
4
+ VERSION = "2.5.0"
5
5
  end
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "ruby2_keywords"
4
3
  require_relative "aggregate_root/version"
5
4
  require_relative "aggregate_root/configuration"
6
5
  require_relative "aggregate_root/transform"
@@ -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.3.0
4
+ version: 2.5.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-09-09 00:00:00.000000000 Z
11
+ date: 2022-06-22 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.3.0
19
+ version: 2.5.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.3.0
26
+ version: 2.5.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.6'
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.11
80
67
  signing_key:
81
68
  specification_version: 4
82
69
  summary: Event sourced aggregate root implementation for RubyEventStore