Class: Periodico

Inherits:
Object
  • Object
show all
Defined in:
lib/periodico.rb,
lib/periodico/version.rb,
lib/periodico/executor.rb,
lib/periodico/subscriber.rb

Defined Under Namespace

Classes: Executor, Subscriber

Constant Summary collapse

DEFAULT_WORKER_POOL_SIZE =
5
VERSION =
"0.1.3"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(worker_pool_size: DEFAULT_WORKER_POOL_SIZE) ⇒ Periodico

Returns a new instance of Periodico.



12
13
14
# File 'lib/periodico.rb', line 12

def initialize(worker_pool_size: DEFAULT_WORKER_POOL_SIZE)
  @worker_pool_size = worker_pool_size
end

Instance Attribute Details

#worker_pool_sizeObject (readonly)

Returns the value of attribute worker_pool_size.



10
11
12
# File 'lib/periodico.rb', line 10

def worker_pool_size
  @worker_pool_size
end

Instance Method Details

#publish(message:, params:) ⇒ Object



16
17
18
19
20
# File 'lib/periodico.rb', line 16

def publish(message:, params:)
  executor.execute do
    Manufacturable.build_all(Subscriber, message, **params).each(&:receive)
  end
end