Class: Upgrow::BasicRepository

Inherits:
Object
  • Object
show all
Defined in:
lib/upgrow/basic_repository.rb

Overview

Base class for Repositories. It offers a basic API for the state all Repositories should have, as well as the logic on how to materialize data into Models.

Direct Known Subclasses

Repository

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBasicRepository

Sets the Basic Repositorie’s state.



28
29
30
# File 'lib/upgrow/basic_repository.rb', line 28

def initialize
  @base = self.class.base
end

Class Attribute Details

.baseObject

the base object to be used internally to retrieve the persisted data. For example, a base class in which queries can be performed for a relational database adapter. Defaults to ‘nil`.

Returns:

  • (Object)

    the Repository base.



16
17
18
# File 'lib/upgrow/basic_repository.rb', line 16

def base
  @base || default_base
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



25
26
27
# File 'lib/upgrow/basic_repository.rb', line 25

def base
  @base
end