Class: Banacle::App

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/banacle/app.rb

Constant Summary collapse

CONTEXT_RACK_ENV_NAME =
'banacle.ctx'

Class Method Summary collapse

Class Method Details

.initialize_context(config) ⇒ Object



23
24
25
26
27
# File 'lib/banacle/app.rb', line 23

def self.initialize_context(config)
  {
    config: config,
  }
end

.rack(config = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/banacle/app.rb', line 13

def self.rack(config={})
  klass = App

  context = initialize_context(config)
  lambda { |env|
    env[CONTEXT_RACK_ENV_NAME] = context
    klass.call(env)
  }
end