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



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

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

.synchronous(*paths) ⇒ Object



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

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

Instance Method Details

#dispatch!Object



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

def dispatch!
  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