Class: DoubleEntry::Transfer::Set Private

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
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

#allObject

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.



51
52
53
# File 'lib/double_entry/transfer.rb', line 51

def all
  backing_collection.values
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
33
34
35
36
37
38
39
# File 'lib/double_entry/transfer.rb', line 30

def define(attributes)
  Transfer.new(attributes).tap do |transfer|
    key = [transfer.from, transfer.to, transfer.code]
    if _find(*key)
      fail DuplicateTransfer
    else
      backing_collection[key] = transfer
    end
  end
end

#find(from_account, to_account, 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.



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

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

#find!(from_account, to_account, 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.



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

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