Class: DoubleEntry::Transfer::Set Private

Inherits:
Array
  • Object
show all
Defined in:
lib/double_entry/transfer.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Instance Method Details

#<<(transfer) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



40
41
42
43
44
45
46
# File 'lib/double_entry/transfer.rb', line 40

def <<(transfer)
  if _find(transfer.from, transfer.to, transfer.code)
    raise DuplicateTransfer.new
  else
    super(transfer)
  end
end

#define(attributes) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



26
27
28
# File 'lib/double_entry/transfer.rb', line 26

def define(attributes)
  self << Transfer.new(attributes)
end

#find(from, to, code) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



30
31
32
# File 'lib/double_entry/transfer.rb', line 30

def find(from, to, code)
  _find(from.identifier, to.identifier, code)
end

#find!(from, to, code) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Raises:



34
35
36
37
38
# File 'lib/double_entry/transfer.rb', line 34

def find!(from, to, code)
  transfer = find(from, to, code)
  raise TransferNotAllowed.new([from.identifier, to.identifier, code].inspect) unless transfer
  return transfer
end