Class: Karafka::Routing::Features::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/karafka/routing/features/base.rb,
lib/karafka/routing/features/base/expander.rb

Overview

Base for all the features

Defined Under Namespace

Classes: Expander

Class Method Summary collapse

Class Method Details

.activateObject

Extends topic and builder with given feature API



15
16
17
18
19
20
# File 'lib/karafka/routing/features/base.rb', line 15

def activate
  Topic.prepend(self::Topic) if const_defined?('Topic', false)
  Proxy.prepend(self::Builder) if const_defined?('Builder', false)
  Builder.prepend(self::Builder) if const_defined?('Builder', false)
  Builder.prepend(Base::Expander.new(self)) if const_defined?('Contract', false)
end

.load_allObject

Loads all the features and activates them



23
24
25
26
27
28
29
# File 'lib/karafka/routing/features/base.rb', line 23

def load_all
  ObjectSpace
    .each_object(Class)
    .select { |klass| klass < self }
    .sort_by(&:to_s)
    .each(&:activate)
end