Class: Thronglets::Registry

Inherits:
Object
  • Object
show all
Defined in:
lib/thronglets/registry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(worker) ⇒ Registry

Returns a new instance of Registry.



6
7
8
# File 'lib/thronglets/registry.rb', line 6

def initialize(worker)
  @worker = worker
end

Instance Attribute Details

#workerObject (readonly)

Returns the value of attribute worker.



4
5
6
# File 'lib/thronglets/registry.rb', line 4

def worker
  @worker
end

Instance Method Details

#load!Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/thronglets/registry.rb', line 10

def load!
  list_classes_in_dir("app/activities").each do |activity|
    if can_register_class?(activity)
      puts format("Registered: %s", activity)
      worker.register_activity(activity)
    end
  end
  list_classes_in_dir("app/workflows").each do |workflow|
    if can_register_class?(workflow)
      puts format("Registered: %s", workflow)
      worker.register_workflow(workflow)
    end
  end
end