Class: Zold::Wallets

Inherits:
Object
  • Object
show all
Defined in:
lib/zold/wallets.rb

Overview

Collection of local wallets

Instance Method Summary collapse

Constructor Details

#initialize(dir) ⇒ Wallets

Returns a new instance of Wallets.



30
31
32
# File 'lib/zold/wallets.rb', line 30

def initialize(dir)
  @dir = dir
end

Instance Method Details

#find(id) ⇒ Object



42
43
44
# File 'lib/zold/wallets.rb', line 42

def find(id)
  Zold::Wallet.new(File.join(@dir, "z-#{id}.xml"))
end

#to_sObject



34
35
36
# File 'lib/zold/wallets.rb', line 34

def to_s
  @dir
end

#totalObject



38
39
40
# File 'lib/zold/wallets.rb', line 38

def total
  Dir.new(@dir).select { |f| File.file?(File.join(@dir, f)) }.count
end