aggregate_root 0.40.1 → 0.41.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: e63fa532bbaf6927f588d0cd50b2c89abc7b9f6ecedc287705f7d53340167101
4
- data.tar.gz: 2e6f68ea32c8d440bae1737003bf80b212fa8941bd1fe89295b5d430530088d9
3
+ metadata.gz: e7f5d9823c1ad8df4c57868b879f08887b51bbfb939eb80a037df6a973e2491b
4
+ data.tar.gz: 942f39b742b4e582e98f726c6b0891077ed424c8dfd40975142da153e17c96cb
5
5
  SHA512:
6
- metadata.gz: 14630172c9ac1989c25faad5fd9044e983f5d6ab367f2833250aae5fd4739105acf6efbabab33965cb9495d4d8fff6fd681a9d33ea046e781a3c8b5200c43acc
7
- data.tar.gz: eaab3e9575870575622285a2602295512ec9390158b31cf8c1250a8b324ce3ed89f4af9b076f437a3065163c3f50313da19fbaa0fabe3bc84612cfcc233acec6
6
+ metadata.gz: 1c9f40ad42533535e1df1bcaeef18a9439d524ba93f3b191f59249d121ec749954a5ce02ff8a51b56746abf8701d48865d5c5316e088cb9ca43936d817098c27
7
+ data.tar.gz: 639dfade2ee8da94eb4fb5aef63b377c12a9b48a2a11cba62fa6fec65c7b9f4759e6c8a4cbcd68a60ecc8ea0c625567bf6d8444adaaa40cde7cb23d0d3e81bda
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
5
  gemspec
data/Makefile CHANGED
@@ -1,7 +1,7 @@
1
1
  GEM_VERSION = $(shell cat ../RES_VERSION)
2
2
  GEM_NAME = aggregate_root
3
3
  REQUIRE = $(GEM_NAME)
4
- IGNORE = AggregateRoot\#events_enumerator
4
+ IGNORE =
5
5
  SUBJECT ?= AggregateRoot*
6
6
 
7
7
  include ../support/make/install.mk
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require 'aggregate_root/version'
@@ -13,9 +14,9 @@ Gem::Specification.new do |spec|
13
14
  spec.summary = %q{Event sourced (with Rails Event Store) aggregate root implementation}
14
15
  spec.description = %q{Event sourced (with Rails Event Store) aggregate root implementation}
15
16
  spec.homepage = 'https://railseventstore.org'
16
- spec.metadata = {
17
- "homepage_uri" => "https://railseventstore.org/",
18
- "changelog_uri" => "https://github.com/RailsEventStore/rails_event_store/releases",
17
+ spec.metadata = {
18
+ "homepage_uri" => "https://railseventstore.org/",
19
+ "changelog_uri" => "https://github.com/RailsEventStore/rails_event_store/releases",
19
20
  "source_code_uri" => "https://github.com/RailsEventStore/rails_event_store",
20
21
  "bug_tracker_uri" => "https://github.com/RailsEventStore/rails_event_store/issues",
21
22
  }
@@ -25,5 +26,5 @@ Gem::Specification.new do |spec|
25
26
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
27
  spec.require_paths = ['lib']
27
28
 
28
- spec.add_dependency 'ruby_event_store', '= 0.40.1'
29
+ spec.add_dependency 'ruby_event_store', '= 0.41.0'
29
30
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'aggregate_root/version'
2
4
  require 'aggregate_root/configuration'
3
5
  require 'aggregate_root/transform'
@@ -5,7 +7,6 @@ require 'aggregate_root/default_apply_strategy'
5
7
  require 'aggregate_root/repository'
6
8
  require 'aggregate_root/instrumented_repository'
7
9
 
8
-
9
10
  module AggregateRoot
10
11
  module OnDSL
11
12
  ANONYMOUS_CLASS = "#<Class:".freeze
@@ -14,6 +15,7 @@ module AggregateRoot
14
15
  event_klasses.each do |event_klass|
15
16
  name = event_klass.to_s
16
17
  raise(ArgumentError, "Anonymous class is missing name") if name.start_with? ANONYMOUS_CLASS
18
+
17
19
  handler_name = "on_#{name}"
18
20
  define_method(handler_name, &block)
19
21
  @on_methods ||= {}
@@ -63,7 +65,7 @@ module AggregateRoot
63
65
  Module.new do
64
66
  def self.included(host_class)
65
67
  host_class.extend OnDSL
66
- host_class.include AggregateRoot.with_strategy(->{ DefaultApplyStrategy.new })
68
+ host_class.include AggregateRoot.with_strategy(-> { DefaultApplyStrategy.new })
67
69
  end
68
70
  end
69
71
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AggregateRoot
2
4
  class << self
3
5
  attr_accessor :configuration
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AggregateRoot
2
4
  MissingHandler = Class.new(StandardError)
3
5
 
@@ -29,7 +31,6 @@ module AggregateRoot
29
31
  event_type.split(%r{::|\.}).last
30
32
  end
31
33
 
32
- private
33
34
  attr_reader :strict, :on_methods
34
35
  end
35
36
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AggregateRoot
2
4
  class InstrumentedRepository
3
5
  def initialize(repository, instrumentation)
@@ -7,18 +9,18 @@ module AggregateRoot
7
9
 
8
10
  def load(aggregate, stream_name)
9
11
  instrumentation.instrument("load.repository.aggregate_root",
10
- aggregate: aggregate,
11
- stream: stream_name) do
12
+ aggregate: aggregate,
13
+ stream: stream_name) do
12
14
  repository.load(aggregate, stream_name)
13
15
  end
14
16
  end
15
17
 
16
18
  def store(aggregate, stream_name)
17
19
  instrumentation.instrument("store.repository.aggregate_root",
18
- aggregate: aggregate,
19
- version: aggregate.version,
20
- stored_events: aggregate.unpublished_events.to_a,
21
- stream: stream_name) do
20
+ aggregate: aggregate,
21
+ version: aggregate.version,
22
+ stored_events: aggregate.unpublished_events.to_a,
23
+ stream: stream_name) do
22
24
  repository.store(aggregate, stream_name)
23
25
  end
24
26
  end
@@ -29,6 +31,7 @@ module AggregateRoot
29
31
  end
30
32
 
31
33
  private
34
+
32
35
  attr_reader :instrumentation, :repository
33
36
  end
34
37
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AggregateRoot
2
4
  class Repository
3
5
  def initialize(event_store = default_event_store)
@@ -5,15 +7,15 @@ module AggregateRoot
5
7
  end
6
8
 
7
9
  def load(aggregate, stream_name)
8
- event_store.read.stream(stream_name).reduce {|_, ev| aggregate.apply(ev) }
10
+ event_store.read.stream(stream_name).reduce { |_, ev| aggregate.apply(ev) }
9
11
  aggregate.version = aggregate.unpublished_events.count - 1
10
12
  aggregate
11
13
  end
12
14
 
13
15
  def store(aggregate, stream_name)
14
16
  event_store.publish(aggregate.unpublished_events.to_a,
15
- stream_name: stream_name,
16
- expected_version: aggregate.version)
17
+ stream_name: stream_name,
18
+ expected_version: aggregate.version)
17
19
  aggregate.version = aggregate.version + aggregate.unpublished_events.count
18
20
  end
19
21
 
@@ -23,10 +25,11 @@ module AggregateRoot
23
25
  end
24
26
 
25
27
  private
28
+
26
29
  attr_reader :event_store
27
30
 
28
31
  def default_event_store
29
32
  AggregateRoot.configuration.default_event_store
30
33
  end
31
34
  end
32
- end
35
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AggregateRoot
2
4
  class Transform
3
5
  def self.to_snake_case(name)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AggregateRoot
2
- VERSION = "0.40.1"
4
+ VERSION = "0.41.0"
3
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aggregate_root
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.40.1
4
+ version: 0.41.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arkency
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-27 00:00:00.000000000 Z
11
+ date: 2019-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby_event_store
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.40.1
19
+ version: 0.41.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.40.1
26
+ version: 0.41.0
27
27
  description: Event sourced (with Rails Event Store) aggregate root implementation
28
28
  email:
29
29
  - dev@arkency.com
@@ -66,7 +66,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
68
  requirements: []
69
- rubygems_version: 3.0.3
69
+ rubyforge_project:
70
+ rubygems_version: 2.7.6.2
70
71
  signing_key:
71
72
  specification_version: 4
72
73
  summary: Event sourced (with Rails Event Store) aggregate root implementation