Class: BitWallet::Accounts
- Inherits:
-
Array
- Object
- Array
- BitWallet::Accounts
- Defined in:
- lib/bit_wallet/accounts.rb
Instance Attribute Summary collapse
-
#wallet ⇒ Object
readonly
Returns the value of attribute wallet.
Instance Method Summary collapse
-
#initialize(wallet) ⇒ Accounts
constructor
A new instance of Accounts.
- #new(name) ⇒ Object
- #with_balance ⇒ Object
Constructor Details
#initialize(wallet) ⇒ Accounts
Returns a new instance of Accounts.
11 12 13 |
# File 'lib/bit_wallet/accounts.rb', line 11 def initialize(wallet) @wallet = wallet end |
Instance Attribute Details
#wallet ⇒ Object (readonly)
Returns the value of attribute wallet.
4 5 6 |
# File 'lib/bit_wallet/accounts.rb', line 4 def wallet @wallet end |
Instance Method Details
#new(name) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/bit_wallet/accounts.rb', line 15 def new(name) account = self.find {|a| a.name == name} return account if account account = BitWallet::Account.new(wallet, name) self << account account end |
#with_balance ⇒ Object
7 8 9 |
# File 'lib/bit_wallet/accounts.rb', line 7 def with_balance self.select { |account| account.balance > 0 } end |