rabl 0.9.0.pre → 0.9.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG.md +2 -1
- data/lib/rabl/engine.rb +3 -3
- data/lib/rabl/version.rb +1 -1
- data/test/engine_test.rb +12 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NzJmMmM2ZjU0NWFmNGI3YmUzZGRiNmJlODhmYzQ2M2E2NTkwMDNiOA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWU5NWU4ZWMyNzc1MmFiNmVjYzNmOGZlOTE0ODk3NDY5YTQ2ODIxMA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MzJlM2ZkMmFmNDE3ZTU0YzY4NGQ1NTJkNDQzMDgxODZiNDI0OGRiMGMwZTg1
|
10
|
+
ZTRhY2E3ZTQ2NDU2Yjk5OWRiZWVjZDY4OTA2NDkzODNhYWM3MzdiMTJiNjQw
|
11
|
+
YzM3NzgyMGFiZjIxYjA0MzYyMDRlNjg3OTdjMmViYWFkMzhkZjM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Y2RjNDI0NjlkZDU0MjQxOWI4OTg2MGM3MDk3YmRhYTI3YjE3MzA3OGEzYjlh
|
14
|
+
ZWEwNThjMzNmNmVkMGM4ZjhmNzE5MWIwYWFiMDc2ZTEwYzI0ZDk5NmFjODRl
|
15
|
+
MzA1YTJkMjEyMTY1ZmZkZGUzNmNkM2YxNTE3MjRmMTFkMGFlOTM=
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
-
## 0.9.0.
|
3
|
+
## 0.9.0.pre2 (Sept 02 2013)
|
4
4
|
|
5
5
|
* FIX #142 Better resource resolution for AR Scopes
|
6
6
|
* Adds Rails 4 test fixture (Thanks @siong1987)
|
7
7
|
* Adds Rails 4 cache digestor (Thanks @siong1987)
|
8
8
|
* Child now supports `object_root` and `root` arguments like 'collection'
|
9
|
+
* FIX #486 Prioritize to_hash options to allow setting root
|
9
10
|
|
10
11
|
## 0.8.6
|
11
12
|
|
data/lib/rabl/engine.rb
CHANGED
@@ -42,7 +42,7 @@ module Rabl
|
|
42
42
|
# Returns a hash representation of the data object
|
43
43
|
# to_hash(:root => true, :child_root => true)
|
44
44
|
def to_hash(options={})
|
45
|
-
options =
|
45
|
+
options = options.merge(@_options)
|
46
46
|
data = @_data_object
|
47
47
|
builder = Rabl::Builder.new(options)
|
48
48
|
options[:root_name] = determine_object_root(@_data_object, @_data_name, options[:root])
|
@@ -293,11 +293,11 @@ module Rabl
|
|
293
293
|
Digestor.digest(@virtual_path, :rabl, lookup_context, dependencies: view_cache_dependencies)
|
294
294
|
]
|
295
295
|
end
|
296
|
-
|
296
|
+
|
297
297
|
def cache_key_simple(key)
|
298
298
|
Array(key) + [@_options[:root_name], @_options[:format]]
|
299
299
|
end
|
300
|
-
|
300
|
+
|
301
301
|
|
302
302
|
end
|
303
303
|
end
|
data/lib/rabl/version.rb
CHANGED
data/test/engine_test.rb
CHANGED
@@ -293,6 +293,18 @@ context "Rabl::Engine" do
|
|
293
293
|
template.render(scope)
|
294
294
|
end.equals "{\"user\":{\"name\":\"leo\",\"users\":[{\"user\":{\"city\":\"UNO\"}},{\"user\":{\"city\":\"DOS\"}}]}}"
|
295
295
|
|
296
|
+
asserts "child chooses name based on symbol if no elements" do
|
297
|
+
template = rabl %{
|
298
|
+
object @bar => :bar
|
299
|
+
child(:foos) { attribute :city }
|
300
|
+
}
|
301
|
+
scope = Object.new
|
302
|
+
bar = Object.new
|
303
|
+
stub(bar).foos { [] }
|
304
|
+
scope.instance_variable_set :@bar, bar
|
305
|
+
template.render(scope)
|
306
|
+
end.equals "{\"bar\":{\"foos\":[]}}"
|
307
|
+
|
296
308
|
asserts "it allows suppression of root node for child collection" do
|
297
309
|
template = rabl %{
|
298
310
|
object @user
|