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
- #active_record_scope_identifier(active_record_class) ⇒ 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.
48 49 50 51 52 53 54 |
# File 'lib/double_entry/account.rb', line 48 def <<(account) if any? { |a| a.identifier == account.identifier } fail DuplicateAccount else super end end |
#active_record_scope_identifier(active_record_class) ⇒ 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.
56 57 58 |
# File 'lib/double_entry/account.rb', line 56 def active_record_scope_identifier(active_record_class) ActiveRecordScopeFactory.new(active_record_class).scope_identifier 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.
36 37 38 |
# File 'lib/double_entry/account.rb', line 36 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.
40 41 42 43 44 45 46 |
# File 'lib/double_entry/account.rb', line 40 def find(identifier, scoped) found_account = detect do |account| account.identifier == identifier && account.scoped? == scoped end fail UnknownAccount, "account: #{identifier} scoped?: #{scoped}" unless found_account found_account end |