Module: ActiveShepherd

Defined in:
lib/active_shepherd.rb,
lib/active_shepherd.rb,
lib/active_shepherd/method.rb,
lib/active_shepherd/version.rb,
lib/active_shepherd/active_record_shim.rb

Defined Under Namespace

Modules: AggregateRoot Classes: Aggregate, ApplyMethod, ChangesValidator, ClassValidator, DeepReverseChanges, Method, QueryMethod, Traversal

Constant Summary collapse

AggregateMismatchError =
Class.new(StandardError)
BadChangeError =
Class.new(StandardError)
InvalidChangesError =
Class.new(StandardError)
Methods =

Set up namespace for the method classes

Module.new
VERSION =
"0.8.4"

Class Method Summary collapse

Class Method Details

.deep_reverse_changes(changes) ⇒ Object



21
22
23
# File 'lib/active_shepherd.rb', line 21

def self.deep_reverse_changes(changes)
  DeepReverseChanges.new(changes).reverse
end

.enable!(activerecord_base) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/active_shepherd/active_record_shim.rb', line 2

def self.enable!(activerecord_base)
  class << activerecord_base
    # FIXME: make this actually check the model to meet the criteria for being
    # an Aggregate Root
    def able_to_act_as_aggregate_root?
      true
    end

    def act_as_aggregate_root!
      include ::ActiveShepherd::AggregateRoot
    end
  end
end