Sha256: 7d5a65f54b25b79ff0785e7937388725b87a2510caffe2c9b0376e73cb1a90ff

Contents?: true

Size: 1.13 KB

Versions: 3

Compression:

Stored size: 1.13 KB

Contents

module Karafka
  # App class
  class App
    class << self
      # Sets up the whole configuration
      # @param [Block] block configuration block
      def setup(&block)
        Setup::Config.setup(&block)
        initialize!
      end

      # Sets up all the internal components and bootstrap whole app
      # We need to know details about routes in order to setup components,
      # that's why we don't setup them after std setup is done
      def boot!
        Setup::Config.setup_components
      end

      # @return [Karafka::Config] config instance
      def config
        Setup::Config.config
      end

      # @return [Karafka::Routing::Builder] routes builder instance
      def routes
        Routing::Builder.instance
      end

      Status.instance_methods(false).each do |delegated|
        define_method(delegated) do
          Status.instance.public_send(delegated)
        end
      end

      # Methods that should be delegated to Karafka module
      %i(
        root env logger monitor
      ).each do |delegated|
        define_method(delegated) do
          Karafka.public_send(delegated)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
karafka-0.5.0.2 lib/karafka/app.rb
karafka-0.5.0.1 lib/karafka/app.rb
karafka-0.5.0 lib/karafka/app.rb