Class: Zold::Routines::Spread

Inherits:
Object
  • Object
show all
Defined in:
lib/zold/commands/routines/spread.rb

Overview

Spread them

Instance Method Summary collapse

Constructor Details

#initialize(opts, wallets, entrance, log: Log::Quiet.new) ⇒ Spread

Returns a new instance of Spread.



35
36
37
38
39
40
# File 'lib/zold/commands/routines/spread.rb', line 35

def initialize(opts, wallets, entrance, log: Log::Quiet.new)
  @opts = opts
  @wallets = wallets
  @entrance = entrance
  @log = log
end

Instance Method Details

#exec(_ = 0) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/zold/commands/routines/spread.rb', line 42

def exec(_ = 0)
  sleep(60) unless @opts['routine-immediately']
  @wallets.all.sample(10).map do |w|
    id = Id.new(w)
    @entrance.push(id, File.read(@wallets.find(id).path))
  end
end