Class: Corpshort::App

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

Constant Summary collapse

CONTEXT_RACK_ENV_NAME =
'corpshort.ctx'

Class Method Summary collapse

Class Method Details

.initialize_context(config) ⇒ Object



24
25
26
27
28
# File 'lib/corpshort/app.rb', line 24

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

.rack(config = {}) ⇒ Object



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/corpshort/app.rb', line 30

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

  test = config[:test]
  session = {}
  context = initialize_context(config)
  lambda { |env|
    env['rack.session'] = session if test # FIXME:
    env[CONTEXT_RACK_ENV_NAME] = context
    klass.call(env)
  }
end