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.



48
49
50
51
52
53
54
# File 'lib/double_entry/account.rb', line 48

def <<()
  if any? { |a| a.identifier == .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)
   = detect do ||
    .identifier == identifier && .scoped? == scoped
  end
  fail UnknownAccount, "account: #{identifier} scoped?: #{scoped}" unless 
  
end