sinatra-symphony 0.2.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/sinatra/symphony.rb +7 -37
  2. metadata +2 -3
@@ -5,46 +5,16 @@ require 'async-rack'
5
5
  module Sinatra
6
6
  class Symphony < Base
7
7
 
8
- def self.route name, path, options = {}, &block
9
- super(name.upcase, path, options) {|*args| async_invoke(*args, &block)}
10
- end
11
-
12
8
  # defaults
13
9
  disable :raise_errors, :show_exceptions
14
10
 
15
- module Helpers
16
- def async_exec args, block
17
- catch(:halt) do
18
- begin
19
- instance_exec(*args, &block)
20
- rescue ::Exception => boom
21
- handle_exception!(boom)
22
- ensure
23
- filter! :after unless env['sinatra.static_file']
24
- end
25
- end
11
+ def invoke
12
+ EM.synchrony do
13
+ super
14
+ env['async.callback'].call response.finish
26
15
  end
27
16
 
28
- def async_invoke *args, &block
29
- EM.synchrony do
30
- res = async_exec(args, block)
31
- res = [res] unless res.kind_of?(Array)
32
-
33
- if Array === res && Fixnum === res.first
34
- status(res.shift)
35
- body(res.pop)
36
- headers(*res)
37
- else
38
- body(res)
39
- end
40
-
41
- env['async.callback'].call response.finish
42
- end
43
-
44
- throw :async
45
- end
17
+ throw :async
46
18
  end
47
-
48
- include Helpers
49
- end
50
- end
19
+ end # Symphony
20
+ end # Sinatra
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-symphony
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-18 00:00:00.000000000 Z
12
+ date: 2012-09-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
@@ -161,4 +161,3 @@ signing_key:
161
161
  specification_version: 3
162
162
  summary: em-synchrony glue for sinatra
163
163
  test_files: []
164
- has_rdoc: