Module: Vedeu::Repositories::Model

Overview

When included into a class, provides the mechanism to store the class in a repository for later retrieval.

Defined Under Namespace

Modules: SingletonMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Common

#absent?, #array?, #boolean, #boolean?, #empty_value?, #escape?, #falsy?, #hash?, #line_model?, #numeric?, #positionable?, #present?, #snake_case, #stream_model?, #string?, #symbol?, #truthy?, #view_model?

Instance Attribute Details

#repositoryVedeu::Repositories::Repository



17
18
19
# File 'lib/vedeu/repositories/model.rb', line 17

def repository
  @repository
end

Class Method Details

.included(klass) ⇒ Class

Provide additional behaviour to a class or module.

Parameters:

  • klass (Class)

Returns:

  • (Class)

    Returns the klass parameter.



69
70
71
# File 'lib/vedeu/repositories/model.rb', line 69

def self.included(klass)
  klass.extend(Vedeu::Repositories::Model::SingletonMethods)
end

Instance Method Details

#store(&block) ⇒ void

TODO:

Perhaps some validation could be added here?

Note:

If a block is given, store the model, return the model after yielding.

This method returns an undefined value.

Returns The model instance stored in the repository.



77
78
79
# File 'lib/vedeu/repositories/model.rb', line 77

def store(&block)
  repository.store(self, &block)
end