Module: AggregateRoot

Defined in:
lib/aggregate_root.rb,
lib/aggregate_root/version.rb,
lib/aggregate_root/transform.rb,
lib/aggregate_root/repository.rb,
lib/aggregate_root/configuration.rb,
lib/aggregate_root/snapshot_repository.rb,
lib/aggregate_root/default_apply_strategy.rb,
lib/aggregate_root/instrumented_repository.rb,
lib/aggregate_root/instrumented_apply_strategy.rb

Defined Under Namespace

Modules: AggregateMethods, Constructor, OnDSL Classes: Configuration, DefaultApplyStrategy, InstrumentedApplyStrategy, InstrumentedRepository, Repository, SnapshotRepository, Transform

Constant Summary collapse

VERSION =
"2.14.0"
MissingHandler =
Class.new(StandardError)

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



5
6
7
# File 'lib/aggregate_root/configuration.rb', line 5

def configuration
  @configuration
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Yields:



8
9
10
11
# File 'lib/aggregate_root/configuration.rb', line 8

def self.configure
  self.configuration ||= Configuration.new
  yield(configuration)
end

.included(host_class) ⇒ Object



103
104
105
# File 'lib/aggregate_root.rb', line 103

def self.included(host_class)
  host_class.include with_default_apply_strategy
end

.with_default_apply_strategyObject



81
82
83
84
85
86
87
88
# File 'lib/aggregate_root.rb', line 81

def self.with_default_apply_strategy
  Module.new do
    def self.included(host_class)
      host_class.extend OnDSL
      host_class.include AggregateRoot.with_strategy(-> { DefaultApplyStrategy.new })
    end
  end
end

.with_strategy(strategy) ⇒ Object



90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/aggregate_root.rb', line 90

def self.with_strategy(strategy)
  Module.new do
    def self.included(host_class)
      host_class.extend Constructor
      host_class.include AggregateMethods
    end

    define_method :apply_strategy do
      strategy.call
    end
  end
end