Class: DoubleEntry::Account::Set Private

Inherits:
Array
  • Object
show all
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

#<<(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 <<()
  if any? { |a| a.identifier == .identifier }
    raise DuplicateAccount.new
  else
    super()
  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 << .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.

Raises:



17
18
19
20
21
22
23
# File 'lib/double_entry/account.rb', line 17

def find(identifier, scoped)
   = detect do ||
    .identifier == identifier && .scoped? == scoped
  end
  raise UnknownAccount.new("account: #{identifier} scoped?: #{scoped}") unless 
  return 
end