Class: DoubleEntry::Account::Set Private
- Inherits:
-
Array
- Object
- Array
- DoubleEntry::Account::Set
- 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
- #<<(account) ⇒ Object private
- #define(attributes) ⇒ Object private
- #find(identifier, scoped) ⇒ Object private
Instance Method Details
#<<(account) ⇒ 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.
25 26 27 28 29 30 31 |
# File 'lib/double_entry/account.rb', line 25 def <<(account) if any? { |a| a.identifier == account.identifier } raise DuplicateAccount.new else super(account) 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.
13 14 15 |
# File 'lib/double_entry/account.rb', line 13 def define(attributes) self << Account.new(attributes) 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.
17 18 19 20 21 22 23 |
# File 'lib/double_entry/account.rb', line 17 def find(identifier, scoped) account = detect do |account| account.identifier == identifier && account.scoped? == scoped end raise UnknownAccount.new("account: #{identifier} scoped?: #{scoped}") unless account return account end |