Class: Sinatra::Symphony

Inherits:
Base
  • Object
show all
Defined in:
lib/sinatra/symphony.rb

Defined Under Namespace

Classes: Test

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.symphonyObject



30
31
32
# File 'lib/sinatra/symphony.rb', line 30

def self.symphony
  @symphony ||= Hash.new {|h, k| h[k] = []}
end

.synchronous(*paths) ⇒ Object



24
25
26
27
28
# File 'lib/sinatra/symphony.rb', line 24

def self.synchronous *paths
  paths.each do |path|
    symphony[:exclude] << path
  end
end

Instance Method Details

#invokeObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/sinatra/symphony.rb', line 11

def invoke
  if self.class.symphony[:exclude].include? @request.path_info
    super
  else
    EM.synchrony do
      super
      env['async.callback'].call response.finish
    end

    throw :async
  end
end