syro 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/lib/syro.rb +3 -3
- data/syro.gemspec +1 -1
- data/test/all.rb +24 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d42da05d9e40f9dd247ca71a2f3b2514fdeedb0a
|
4
|
+
data.tar.gz: 6019c98bff4e489bcd0f1f5975dc046a3ab94193
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52a247d00e9b09cd152a65e8702150e8df91c50f66bc811f7ac94be90ba3dd3e9b93cb016a70474ac4c19005835ad62382c3d920edb49777b991cac7d4ab2106
|
7
|
+
data.tar.gz: 15c8260bae6bf88ffbb1882b2c4a9cb50ab97b4d693ba4b98ba2a254d014175c6c1c10d48ec570767039081d76395aefb0f390c96d1b80730d7934e0418aaa37
|
data/lib/syro.rb
CHANGED
@@ -123,7 +123,7 @@ class Syro
|
|
123
123
|
def call(env, inbox)
|
124
124
|
@syro_env = env
|
125
125
|
@syro_req = Rack::Request.new(env)
|
126
|
-
@syro_res = Syro::Response.new
|
126
|
+
@syro_res = Syro::Response.new
|
127
127
|
@syro_path = Seg.new(env.fetch(Syro::PATH_INFO))
|
128
128
|
@syro_inbox = inbox
|
129
129
|
|
@@ -248,10 +248,10 @@ class Syro
|
|
248
248
|
end
|
249
249
|
|
250
250
|
def initialize(&block)
|
251
|
-
@
|
251
|
+
@code = block
|
252
252
|
end
|
253
253
|
|
254
254
|
def call(env, inbox = {})
|
255
|
-
@
|
255
|
+
Sandbox.new(@code).call(env, inbox)
|
256
256
|
end
|
257
257
|
end
|
data/syro.gemspec
CHANGED
data/test/all.rb
CHANGED
@@ -88,6 +88,20 @@ app = Syro.new {
|
|
88
88
|
}
|
89
89
|
}
|
90
90
|
}
|
91
|
+
|
92
|
+
on("one") {
|
93
|
+
@one = "1"
|
94
|
+
|
95
|
+
get {
|
96
|
+
res.write(@one)
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
on("two") {
|
101
|
+
get {
|
102
|
+
res.write(@one)
|
103
|
+
}
|
104
|
+
}
|
91
105
|
}
|
92
106
|
|
93
107
|
setup do
|
@@ -157,3 +171,13 @@ test "inherited inbox" do |f|
|
|
157
171
|
assert_equal "GET /posts/42/comments", f.last_response.body
|
158
172
|
assert_equal 200, f.last_response.status
|
159
173
|
end
|
174
|
+
|
175
|
+
test "leaks" do |f|
|
176
|
+
f.get("/one")
|
177
|
+
assert_equal "1", f.last_response.body
|
178
|
+
assert_equal 200, f.last_response.status
|
179
|
+
|
180
|
+
f.get("/two")
|
181
|
+
assert_equal "", f.last_response.body
|
182
|
+
assert_equal 200, f.last_response.status
|
183
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: syro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michel Martens
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: seg
|