Class: RubyPitaya::InitializerBroadcast

Inherits:
Object
  • Object
show all
Defined in:
lib/rubypitaya/core/initializer_broadcast.rb,
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rubypitaya-3.12.1/lib/rubypitaya/core/initializer_broadcast.rb

Instance Method Summary collapse

Instance Method Details

#run(initializer_content) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rubypitaya/core/initializer_broadcast.rb', line 8

def run(initializer_content)
  app_classes = []
  plugin_classes = []

  ObjectSpace.each_object(InitializerBase.singleton_class) do |klass|
    is_plugin_class = klass.path.include?('plugins')

    if is_plugin_class
      plugin_classes << klass
    else
      app_classes << klass
    end
  end

  plugin_classes.each do |klass|
    instance = klass.new
    instance.run(initializer_content)
  end

  app_classes.each do |klass|
    instance = klass.new
    instance.run(initializer_content)
  end
end