Class: DoubleEntry::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/double_entry/account.rb

Defined Under Namespace

Classes: ActiveRecordScopeFactory, Instance, Set

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Account

Returns a new instance of Account.



106
107
108
# File 'lib/double_entry/account.rb', line 106

def initialize(attributes)
  attributes.each { |name, value| send("#{name}=", value) }
end

Instance Attribute Details

#identifierObject

Returns the value of attribute identifier.



104
105
106
# File 'lib/double_entry/account.rb', line 104

def identifier
  @identifier
end

#positive_onlyObject

Returns the value of attribute positive_only.



104
105
106
# File 'lib/double_entry/account.rb', line 104

def positive_only
  @positive_only
end

#scope_identifierObject

Returns the value of attribute scope_identifier.



104
105
106
# File 'lib/double_entry/account.rb', line 104

def scope_identifier
  @scope_identifier
end

Class Method Details

.account(defined_accounts, identifier, options = {}) ⇒ 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.



6
7
8
9
# File 'lib/double_entry/account.rb', line 6

def self.(defined_accounts, identifier, options = {})
   = defined_accounts.find(identifier, options[:scope].present?)
  DoubleEntry::Account::Instance.new(:account => , :scope => options[:scope])
end

Instance Method Details

#scoped?Boolean

Returns:

  • (Boolean)


110
111
112
# File 'lib/double_entry/account.rb', line 110

def scoped?
  !!scope_identifier
end