rabl 0.9.0.pre → 0.9.0.pre2

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTIxZTEwYWE5ZDNlN2IxOTc1MDZlMjk3NTg1YWQ5OTgxMmE1MmEyZA==
4
+ NzJmMmM2ZjU0NWFmNGI3YmUzZGRiNmJlODhmYzQ2M2E2NTkwMDNiOA==
5
5
  data.tar.gz: !binary |-
6
- NDE4MDQwNTA3ZmE1OTk3YTMzYmRlZWFkYjViYjJjZTEwOTM1OGM5MA==
6
+ YWU5NWU4ZWMyNzc1MmFiNmVjYzNmOGZlOTE0ODk3NDY5YTQ2ODIxMA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZDE2NTBiNGI1ZGMzMmUzYTYyNzA3YmRjM2M5ZjQyMjM0ZjE2MjA5ZTcxNzA0
10
- YTlhZDBjZTI3ZjAzYWMyMzQ2Yjg5MTkwZDc1NDY5YmYzOTA0NzlhN2Q5ZDBj
11
- Yjk5OWM3NDAzODYwYThhMDQ0YTE4NmVmOTgxNDBlNDZkMjVhNTY=
9
+ MzJlM2ZkMmFmNDE3ZTU0YzY4NGQ1NTJkNDQzMDgxODZiNDI0OGRiMGMwZTg1
10
+ ZTRhY2E3ZTQ2NDU2Yjk5OWRiZWVjZDY4OTA2NDkzODNhYWM3MzdiMTJiNjQw
11
+ YzM3NzgyMGFiZjIxYjA0MzYyMDRlNjg3OTdjMmViYWFkMzhkZjM=
12
12
  data.tar.gz: !binary |-
13
- YmU2YWZhNWQ3OGZiNWVjNGU1NDQxOTlmNTU4ZDRlZGQ0ZGU2ZTg3MDMyMmQw
14
- ZGQwYjU2ZDcyOWUwMjljNGUxMTA2N2VhYzUzODc2MzBkYjBiODdkNzEyNDJm
15
- ZjBmMGZjN2ZjMTY0NDk2YTVlYmIxMWQ2YTU1NTgwZjU2OTVlZTg=
13
+ Y2RjNDI0NjlkZDU0MjQxOWI4OTg2MGM3MDk3YmRhYTI3YjE3MzA3OGEzYjlh
14
+ ZWEwNThjMzNmNmVkMGM4ZjhmNzE5MWIwYWFiMDc2ZTEwYzI0ZDk5NmFjODRl
15
+ MzA1YTJkMjEyMTY1ZmZkZGUzNmNkM2YxNTE3MjRmMTFkMGFlOTM=
@@ -1,11 +1,12 @@
1
1
  # CHANGELOG
2
2
 
3
- ## 0.9.0.pre (Sept 02 2013)
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
 
@@ -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 = @_options.merge(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
@@ -1,3 +1,3 @@
1
1
  module Rabl
2
- VERSION = "0.9.0.pre"
2
+ VERSION = "0.9.0.pre2"
3
3
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0.pre
4
+ version: 0.9.0.pre2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Esquenazi