Class: Zold::Wallets
- Inherits:
-
Object
- Object
- Zold::Wallets
- Defined in:
- lib/zold/wallets.rb
Overview
Collection of local wallets
Instance Method Summary collapse
- #find(id) ⇒ Object
-
#initialize(dir) ⇒ Wallets
constructor
A new instance of Wallets.
- #to_s ⇒ Object
- #total ⇒ Object
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_s ⇒ Object
34 35 36 |
# File 'lib/zold/wallets.rb', line 34 def to_s @dir end |
#total ⇒ Object
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 |