Class: Conquer::Scroller

Inherits:
Container show all
Defined in:
lib/conquer/scroller.rb

Defined Under Namespace

Classes: Worker

Constant Summary collapse

DEFAULT_OPTIONS =
{
  speed: 1,
  width: 20,
  every: 0,
  step: 2
}.freeze

Instance Attribute Summary

Attributes inherited from Container

#children

Instance Method Summary collapse

Methods inherited from Container

#register

Constructor Details

#initialize(topic, options) ⇒ Scroller

Returns a new instance of Scroller.



57
58
59
60
# File 'lib/conquer/scroller.rb', line 57

def initialize(topic, options)
  super(topic)
  @options = DEFAULT_OPTIONS.merge(options)
end

Instance Method Details

#start_workerObject



62
63
64
65
# File 'lib/conquer/scroller.rb', line 62

def start_worker
  Worker.supervise(args: [@topic, @children.keys, @options])
  @children.values.each(&:start_worker)
end