Class: Karafka::Pro::Routing::Features::Filtering::Config

Inherits:
Struct
  • Object
show all
Defined in:
lib/karafka/pro/routing/features/filtering/config.rb

Overview

Filtering feature configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#factoriesObject

Returns the value of attribute factories

Returns:

  • (Object)

    the current value of factories



20
21
22
# File 'lib/karafka/pro/routing/features/filtering/config.rb', line 20

def factories
  @factories
end

Instance Method Details

#active?Boolean

Returns is this feature in use. Are any filters defined.

Returns:

  • (Boolean)

    is this feature in use. Are any filters defined



22
23
24
# File 'lib/karafka/pro/routing/features/filtering/config.rb', line 22

def active?
  !factories.empty?
end

#filtersArray<Object>

Returns array of filters applicable to a topic partition.

Returns:

  • (Array<Object>)

    array of filters applicable to a topic partition



27
28
29
# File 'lib/karafka/pro/routing/features/filtering/config.rb', line 27

def filters
  factories.map(&:call)
end

#to_hHash

Returns this config hash.

Returns:

  • (Hash)

    this config hash



32
33
34
# File 'lib/karafka/pro/routing/features/filtering/config.rb', line 32

def to_h
  super.merge(active: active?)
end