Class: DoubleEntry::Account::Set Private
- Inherits:
-
Object
- Object
- DoubleEntry::Account::Set
- 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
- #all ⇒ Object private
- #define(attributes) ⇒ Object private
- #find(identifier, scoped) ⇒ Object private
- #find_without_scope(identifier) ⇒ Object private
Instance Method Details
#all ⇒ 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.
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 |account| if find_without_scope(account.identifier) fail DuplicateAccount else backing_collection[account.identifier] = account 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) found_account = find_without_scope(identifier) if found_account && found_account.scoped? == scoped found_account 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 |