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.



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

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.



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

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.



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

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.



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

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