Sha256: 11177144a6d167094e924c30bc40389dd3dce3b4f5044ae182a999d67b5a983a

Contents?: true

Size: 894 Bytes

Versions: 20

Compression:

Stored size: 894 Bytes

Contents

# inlined from sinatra-synchrony
require 'sinatra/base'
require 'rack/fiber_pool'
require 'eventmachine'
require 'em-http-request'
require 'em-synchrony'
require 'em-resolv-replace'

module Sinatra
  module Synchrony
    def self.registered(app)
      app.disable :threaded
    end

    def setup_sessions(builder)
      builder.use Rack::FiberPool, {:rescue_exception => handle_exception } unless test?
      super
    end

    def handle_exception
      Proc.new do |env, e|
        if settings.show_exceptions?
          request = Sinatra::Request.new(env)
          printer = Sinatra::ShowExceptions.new(proc{ raise e })
          s, h, b = printer.call(env)
          [s, h, b]
        else
          [500, {}, ""]
        end
      end
    end

    class << self
      def overload_tcpsocket!
        require 'sinatra/synchrony/tcpsocket'
      end
    end
  end
  register Synchrony
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
big_brother-0.8.8.1 lib/sinatra/synchrony.rb
big_brother-0.8.8 lib/sinatra/synchrony.rb
big_brother-0.8.7 lib/sinatra/synchrony.rb
big_brother-0.6.8 lib/sinatra/synchrony.rb
big_brother-0.6.7 lib/sinatra/synchrony.rb
big_brother-0.6.6 lib/sinatra/synchrony.rb
big_brother-0.6.5 lib/sinatra/synchrony.rb
big_brother-0.6.4 lib/sinatra/synchrony.rb
big_brother-0.6.3 lib/sinatra/synchrony.rb
big_brother-0.6.2 lib/sinatra/synchrony.rb
big_brother-0.6.1 lib/sinatra/synchrony.rb
big_brother-0.6.0 lib/sinatra/synchrony.rb
big_brother-0.5.0 lib/sinatra/synchrony.rb
big_brother-0.4.1 lib/sinatra/synchrony.rb
big_brother-0.4.0 lib/sinatra/synchrony.rb
big_brother-0.3.1 lib/sinatra/synchrony.rb
big_brother-0.3.0 lib/sinatra/synchrony.rb
big_brother-0.2.1 lib/sinatra/synchrony.rb
big_brother-0.2.0 lib/sinatra/synchrony.rb
big_brother-0.1.0 lib/sinatra/synchrony.rb