rabl 0.14.4 → 0.14.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +2 -2
- data/lib/rabl/engine.rb +8 -0
- data/lib/rabl/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f8f5c72fe30d17c5b7c2ae3aca6e6656d7ffe7328af4500a7bc05b768e4565e
|
4
|
+
data.tar.gz: bc687948b0f47252b5bc1adb82e93de1799accc7cfd4ed7dbb553229f8e5a0d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae6541b60f172489bb74441ec17e2e47b8512793b3476b6dbcdd85db147437a23200817f8a78422a739043b3ebd824dfc8662bc5160058160579149bd1ffb840
|
7
|
+
data.tar.gz: 7e09471906df9571caff5afb224d0231fa9b9fc177d0422fbaf2d81cd631958b8bfbb802ec221965140b0214152f561172614b37967b0ccc8742886e9ec16dc5
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -184,9 +184,9 @@ If `replace_nil_values_with_empty_strings` is set to `true`, all values that are
|
|
184
184
|
|
185
185
|
If `exclude_nil_values` is set to `true`, all values that are `nil` and would normally be displayed as `null` in the response are not included in the response.
|
186
186
|
|
187
|
-
if `exclude_empty_values_in_collections` is set to `true`, all
|
187
|
+
if `exclude_empty_values_in_collections` is set to `true`, all values in a collection that are `{}` and would normally be displayed as `{}` in the response are not included in the response.
|
188
188
|
|
189
|
-
If `camelize_keys` is set to `true`, all object keys will be converted to camel case. By default the first character will be lower case. The value can be set to `:upper` to set the first
|
189
|
+
If `camelize_keys` is set to `true`, all object keys will be converted to camel case. By default the first character will be lower case. The value can be set to `:upper` to set the first character to upper case.
|
190
190
|
|
191
191
|
If you wish to use [oj](https://github.com/ohler55/oj) as
|
192
192
|
the primary JSON encoding engine simply add that to your Gemfile:
|
data/lib/rabl/engine.rb
CHANGED
@@ -6,6 +6,7 @@ module Rabl
|
|
6
6
|
|
7
7
|
# List of supported rendering formats
|
8
8
|
FORMATS = [:json, :xml, :plist, :bson, :msgpack]
|
9
|
+
SAFE_FORMATS = FORMATS + [:mpac, :dumpable, :hash]
|
9
10
|
|
10
11
|
# Constructs a new ejs engine based on given vars, handler and declarations
|
11
12
|
# Rabl::Engine.new("...source...", { :format => "xml", :root => true, :view_path => "/path/to/views" })
|
@@ -395,6 +396,10 @@ module Rabl
|
|
395
396
|
defined?(Rails) && Rails.version =~ /^[456]/
|
396
397
|
end
|
397
398
|
|
399
|
+
def valid_format?(format)
|
400
|
+
SAFE_FORMATS.include?(format.to_sym) && respond_to?("to_#{format}")
|
401
|
+
end
|
402
|
+
|
398
403
|
def set_instance_variables!(context_scope, locals)
|
399
404
|
@_context_scope = context_scope
|
400
405
|
@_locals = locals || {}
|
@@ -403,6 +408,9 @@ module Rabl
|
|
403
408
|
|
404
409
|
@_options[:format] ||= request_format
|
405
410
|
|
411
|
+
# Prevent calls to inherited methods `to_yaml`, `to_enum`, etc.
|
412
|
+
@_options[:format] = 'json' unless valid_format?(@_options[:format])
|
413
|
+
|
406
414
|
set_locals(@_locals)
|
407
415
|
end
|
408
416
|
|
data/lib/rabl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rabl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Esquenazi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -169,7 +169,7 @@ homepage: https://github.com/nesquena/rabl
|
|
169
169
|
licenses:
|
170
170
|
- MIT
|
171
171
|
metadata: {}
|
172
|
-
post_install_message:
|
172
|
+
post_install_message:
|
173
173
|
rdoc_options: []
|
174
174
|
require_paths:
|
175
175
|
- lib
|
@@ -185,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
185
|
version: '0'
|
186
186
|
requirements: []
|
187
187
|
rubygems_version: 3.0.6
|
188
|
-
signing_key:
|
188
|
+
signing_key:
|
189
189
|
specification_version: 4
|
190
190
|
summary: General ruby templating with json, bson, xml and msgpack support
|
191
191
|
test_files: []
|