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.



39
40
41
42
43
44
45
# File 'lib/double_entry/account.rb', line 39

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



47
48
49
# File 'lib/double_entry/account.rb', line 47

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.



27
28
29
# File 'lib/double_entry/account.rb', line 27

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:



31
32
33
34
35
36
37
# File 'lib/double_entry/account.rb', line 31

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