Class: Financial::AccountManager
- Inherits:
-
Object
- Object
- Financial::AccountManager
- Includes:
- Singleton
- Defined in:
- lib/financial/account_manager.rb
Instance Attribute Summary collapse
-
#accounts ⇒ Object
Returns the value of attribute accounts.
Instance Method Summary collapse
- #find_account(account_name) ⇒ Object
-
#initialize ⇒ AccountManager
constructor
A new instance of AccountManager.
- #new_account(args) ⇒ Object
Constructor Details
#initialize ⇒ AccountManager
Returns a new instance of AccountManager.
8 9 10 |
# File 'lib/financial/account_manager.rb', line 8 def initialize @accounts = [] end |
Instance Attribute Details
#accounts ⇒ Object
Returns the value of attribute accounts.
6 7 8 |
# File 'lib/financial/account_manager.rb', line 6 def accounts @accounts end |
Instance Method Details
#find_account(account_name) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/financial/account_manager.rb', line 18 def find_account(account_name) if account_name == :all or account_name == :todas @accounts else @accounts.select { |a_account| a_account.name.equal?(account_name) } end end |