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.



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

def <<(transfer)
  if _find(transfer.from, transfer.to, transfer.code)
    fail DuplicateTransfer
  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.



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

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.



33
34
35
# File 'lib/double_entry/transfer.rb', line 33

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.



37
38
39
40
41
# File 'lib/double_entry/transfer.rb', line 37

def find!(from, to, code)
  find(from, to, code).tap do |transfer|
    fail TransferNotAllowed, [from.identifier, to.identifier, code].inspect unless transfer
  end
end