Module: Jets::Shim

Extended by:
Shim, Memoist
Included in:
Shim
Defined in:
lib/jets/shim.rb,
lib/jets/shim/config.rb,
lib/jets/shim/handler.rb,
lib/jets/shim/maintenance.rb

Defined Under Namespace

Modules: Adapter, Response Classes: Config, Handler, Maintenance

Instance Method Summary collapse

Instance Method Details

#bootObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/jets/shim.rb', line 15

def boot
  # Don't boot Jets in maintenance mode. Makes cold start much faster.
  return if Maintenance.enabled?

  paths = %w[
    config/jets/shim.rb
  ]
  paths.map! do |path|
    path.starts_with?(".") ? path : "./#{path}"
  end
  found = paths.find { |p| File.exist?(p) }
  if found
    require found # calls Jets.shim.configure
  else
    config.rack_app # all settings are inferred
  end

  # Boot Jets to add additional features
  Jets.boot
end

#configObject



40
41
42
# File 'lib/jets/shim.rb', line 40

def config
  Config.instance
end

#configure {|config| ... } ⇒ Object

Yields:



36
37
38
# File 'lib/jets/shim.rb', line 36

def configure
  yield config
end

#handler(event, context, route = nil) ⇒ Object



7
8
9
# File 'lib/jets/shim.rb', line 7

def handler(event, context, route = nil)
  Handler.new(event, context, route).handle
end

#to_rack_env(event, context) ⇒ Object



11
12
13
# File 'lib/jets/shim.rb', line 11

def to_rack_env(event, context)
  Handler.new(event, context).to_rack_env
end