Class: BitWallet::Accounts

Inherits:
Array
  • Object
show all
Defined in:
lib/bit_wallet/accounts.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#walletObject (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)
   = self.find {|a| a.name == name}
  return  if 
   = BitWallet::Account.new(wallet, name)
  self << 
  
end

#with_balanceObject



7
8
9
# File 'lib/bit_wallet/accounts.rb', line 7

def with_balance
  self.select { || .balance > 0 }
end