Class: DoubleEntry::Account::Set Private

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/double_entry/account.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.



57
58
59
# File 'lib/double_entry/account.rb', line 57

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.



33
34
35
36
37
38
39
40
41
# File 'lib/double_entry/account.rb', line 33

def define(attributes)
  Account.new(attributes).tap do ||
    if find_without_scope(.identifier)
      fail DuplicateAccount
    else
      backing_collection[.identifier] = 
    end
  end
end

#find(identifier, scoped) ⇒ 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
50
51
# File 'lib/double_entry/account.rb', line 43

def find(identifier, scoped)
   = find_without_scope(identifier)

  if  && .scoped? == scoped
    
  else
    fail UnknownAccount, "account: #{identifier} scoped?: #{scoped}"
  end
end

#find_without_scope(identifier) ⇒ 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.



53
54
55
# File 'lib/double_entry/account.rb', line 53

def find_without_scope(identifier)
  backing_collection[identifier]
end