Class: Deposit

Inherits:
Object
  • Object
show all
Defined in:
lib/vendra/domain/models/entities/deposit/deposit.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(repository) ⇒ Deposit

Returns a new instance of Deposit.



26
27
28
# File 'lib/vendra/domain/models/entities/deposit/deposit.rb', line 26

def initialize(repository)
  @repository = repository
end

Instance Attribute Details

#cache_piecesObject

Returns the value of attribute cache_pieces.



24
25
26
# File 'lib/vendra/domain/models/entities/deposit/deposit.rb', line 24

def cache_pieces
  @cache_pieces
end

Class Method Details

.instanceObject



3
4
5
# File 'lib/vendra/domain/models/entities/deposit/deposit.rb', line 3

def instance
  @instance ||= (find || create)
end

Instance Method Details

#insert(value) ⇒ Object



30
31
32
33
34
# File 'lib/vendra/domain/models/entities/deposit/deposit.rb', line 30

def insert(value)
  cache_piece = CachePiece.new(value)
  cache_pieces << cache_piece
  update
end

#updateObject



36
37
38
# File 'lib/vendra/domain/models/entities/deposit/deposit.rb', line 36

def update
  repository.update(self)
end