Class: Zold::SyncWallets

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

Overview

Synchronized collection of wallets

Instance Method Summary collapse

Constructor Details

#initialize(wallets, timeout: 30, log: Log::Quiet.new) ⇒ SyncWallets

Returns a new instance of SyncWallets.



33
34
35
36
37
# File 'lib/zold/sync_wallets.rb', line 33

def initialize(wallets, timeout: 30, log: Log::Quiet.new)
  @wallets = wallets
  @log = log
  @timeout = timeout
end

Instance Method Details

#allObject



47
48
49
# File 'lib/zold/sync_wallets.rb', line 47

def all
  @wallets.all
end

#find(id) ⇒ Object



51
52
53
54
55
56
57
# File 'lib/zold/sync_wallets.rb', line 51

def find(id)
  @wallets.find(id) do |wallet|
    Futex.new(wallet.path, log: @log).open do
      yield wallet
    end
  end
end

#pathObject



43
44
45
# File 'lib/zold/sync_wallets.rb', line 43

def path
  @wallets.path
end

#to_sObject



39
40
41
# File 'lib/zold/sync_wallets.rb', line 39

def to_s
  @wallets.to_s
end