Sha256: ab483de1bfe5f695dece2594cb0edee2cfd3208495ad3e87486ae86f120876a6

Contents?: true

Size: 448 Bytes

Versions: 3

Compression:

Stored size: 448 Bytes

Contents

module BitWallet
  class Accounts < Array

    attr_reader :wallet
    delegate :client, to: :wallet

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

    def initialize(wallet)
      @wallet = wallet
    end

    def new(name)
      account = self.find {|a| a.name == name}
      return account if account
      account = BitWallet::Account.new(wallet, name)
      self << account
      account
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bit_wallet-0.7.6 lib/bit_wallet/accounts.rb
bit_wallet-0.7.5 lib/bit_wallet/accounts.rb
bit_wallet-0.7.3 lib/bit_wallet/accounts.rb