nested 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/nested.rb +6 -4
- data/nested.gemspec +1 -1
- 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: 0848b622722b803a47292fbb298a97c0ca097154
|
4
|
+
data.tar.gz: 5698f92ae5a96473cb82eac89aeeb07b79c92de3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f0b1548126982be321fe5b0ef13861fff316516ee430eefe98785862df2b48cf3673ac23cfb67595208eb600f91a3dd6d518e79ac0c30f4ea884e646577285c
|
7
|
+
data.tar.gz: b5280a354b1be353fa9c1014580a62b8612ec3a3625372c51eef614ee8dc859d404823cb77045f8d77b6c73d905409b6f1fc46beb208b82c1502c59b4b1d61cb
|
data/lib/nested.rb
CHANGED
@@ -180,18 +180,20 @@ module Nested
|
|
180
180
|
|
181
181
|
def sinatra_init_data(sinatra, &block)
|
182
182
|
sinatra.request.body.rewind
|
183
|
-
|
184
|
-
|
183
|
+
raw_data = HashWithIndifferentAccess.new(JSON.parse(sinatra.request.body.read))
|
184
|
+
|
185
|
+
sinatra.instance_variable_set("@__raw_data", raw_data)
|
186
|
+
sinatra.instance_variable_set("@__data", raw_data.values_at(*block.parameters.map(&:last)))
|
185
187
|
end
|
186
188
|
|
187
189
|
def sinatra_exec_put_block(sinatra, &block)
|
188
190
|
sinatra_init_data(sinatra, &block)
|
189
|
-
sinatra.instance_exec(
|
191
|
+
sinatra.instance_exec(*sinatra.instance_variable_get("@__data"), &block)
|
190
192
|
end
|
191
193
|
|
192
194
|
def sinatra_exec_post_block(sinatra, &block)
|
193
195
|
sinatra_init_data(sinatra, &block)
|
194
|
-
res = sinatra.instance_exec(
|
196
|
+
res = sinatra.instance_exec(*sinatra.instance_variable_get("@__data"), &block)
|
195
197
|
sinatra.instance_variable_set("@#{self.instance_variable_name}", res)
|
196
198
|
end
|
197
199
|
|
data/nested.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nested
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan Zimmek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|