Class: Karafka::Web::Ui::Routes::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/karafka/web/ui/routes/base.rb

Overview

Base class for all sub-routes that we want to use Splitting this makes the Roda app much smaller and allows us to operate within the scope of one routing namespace easily

Class Method Summary collapse

Class Method Details

.bind(app, request) ⇒ nil

Binds given routing block to Roda

Parameters:

Returns:

  • (nil)

    We should always return nil so Roda does not interpret it as a custom result



26
27
28
29
30
# File 'lib/karafka/web/ui/routes/base.rb', line 26

def bind(app, request)
  app.instance_exec(request, &@route_block)

  nil
end

.route(&block) ⇒ Object

Stores the sub-routing

Parameters:

  • block (Proc)

    routing block that we want to evaluate in roda



16
17
18
# File 'lib/karafka/web/ui/routes/base.rb', line 16

def route(&block)
  @route_block = block
end