Module: Akasha::SyntaxHelpers::ClassMethods

Defined in:
lib/akasha/aggregate/syntax_helpers.rb

Overview

Aggregate class methods.

Instance Method Summary collapse

Instance Method Details

#connect!(repository) ⇒ Object

Connects to a repository.



22
23
24
# File 'lib/akasha/aggregate/syntax_helpers.rb', line 22

def connect!(repository)
  @@repository = repository
end

#find_or_create(id) ⇒ Object

Creates and loads the aggregate.



32
33
34
# File 'lib/akasha/aggregate/syntax_helpers.rb', line 32

def find_or_create(id)
  @@repository.load_aggregate(self, id)
end

#repositoryObject

Returns repository or nil if ‘connect!` not called.



27
28
29
# File 'lib/akasha/aggregate/syntax_helpers.rb', line 27

def repository
  @@repository
end