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.



45
46
47
48
49
50
51
# File 'lib/double_entry/transfer.rb', line 45

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.



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

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.



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

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:



39
40
41
42
43
# File 'lib/double_entry/transfer.rb', line 39

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