lib/zold/tree_wallets.rb in zold-0.16.24 vs lib/zold/tree_wallets.rb in zold-0.16.25
- old
+ new
@@ -55,10 +55,11 @@
basename =~ /^[0-9a-fA-F]{16}$/ &&
Id.new(basename).to_s == basename
end.map { |w| Id.new(File.basename(w, Wallet::EXT)) }
end
- def find(id)
+ def acq(id, exclusive: false)
+ raise 'The flag can\'t be nil' if exclusive.nil?
raise 'Id can\'t be nil' if id.nil?
raise 'Id must be of type Id' unless id.is_a?(Id)
yield Wallet.new(
File.join(path, (id.to_s.split('', 5).take(4) + [id.to_s]).join('/') + Wallet::EXT)
)