rabl 0.14.5 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -0
- data/CONTRIBUTING.md +1 -1
- data/README.md +2 -1
- data/lib/rabl/builder.rb +1 -0
- data/lib/rabl/digestor/rails3.rb +2 -0
- data/lib/rabl/digestor/rails41.rb +2 -0
- data/lib/rabl/digestor/rails5.rb +2 -0
- data/lib/rabl/digestor.rb +2 -0
- data/lib/rabl/engine.rb +4 -4
- data/lib/rabl/railtie.rb +1 -1
- data/lib/rabl/template.rb +2 -2
- data/lib/rabl/version.rb +1 -1
- data/lib/rabl.rb +3 -3
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91c470d38efde97412e3291ae2445165daecbd06410818ad0043c8398acff5c6
|
4
|
+
data.tar.gz: 6dd9d32a042987020e50a05d4e164ab6d616345e0696e2d411fc74acf0b65781
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ecb3137c900dcf729baec44e89e9d626d108f7ac3d6ae476c64586e26aaee6b27f0a3a08a0a7232f87fe243292802c0f3c96fc9d51fb8c1faa0df5608ff2627
|
7
|
+
data.tar.gz: 51f138ada14f33aa10ddddf10f488a8042d9fe43a5cf3e2ab472f1c8b7487e28034ebac9953c6c33de81586464e6610b430f3cdb90d92772c3b05152300e7dbd
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
# CHANGELOG
|
2
2
|
|
3
|
+
## 0.16.0 (August 21, 2022)
|
4
|
+
|
5
|
+
* Add "except" option to `extends` (Thanks @perryqh)
|
6
|
+
* Fix `ArgumentError` when block given with keyword arguments (Thanks @kyoshidajp)
|
7
|
+
* Add Ruby 3.1 to the CI matrix (Thanks @petergoldstein)
|
8
|
+
* Document Rabl setting `oj`'s mode (Thanks @ghiculescu)
|
9
|
+
|
10
|
+
## 0.15.0 (December 30, 2021)
|
11
|
+
|
12
|
+
* Support for Rails 7 (@tagliala)
|
13
|
+
* Improvements to unit testing
|
14
|
+
* Miscellanious other bug fixes
|
15
|
+
|
3
16
|
## 0.14.5 (May 29th, 2021)
|
4
17
|
|
5
18
|
* Restrict and validate the `to_***` methods available within engine (Brian McFadden)
|
data/CONTRIBUTING.md
CHANGED
@@ -34,4 +34,4 @@ Syntax:
|
|
34
34
|
|
35
35
|
And in case we didn't emphasize it enough: we love tests!
|
36
36
|
|
37
|
-
NOTE: Adapted from https://raw.
|
37
|
+
NOTE: Adapted from https://raw.githubusercontent.com/thoughtbot/factory_bot_rails/main/CONTRIBUTING.md
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# RABL #
|
2
2
|
|
3
|
-
[![Continuous Integration status](https://
|
3
|
+
[![Continuous Integration status](https://github.com/nesquena/rabl/actions/workflows/ci.yml/badge.svg)](https://github.com/nesquena/rabl/actions)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/nesquena/rabl.svg)](https://codeclimate.com/github/nesquena/rabl)
|
5
5
|
|
6
6
|
RABL (Ruby API Builder Language) is a Rails and [Padrino](http://padrinorb.com) ruby templating system for generating JSON, XML, MessagePack, PList and BSON.
|
@@ -51,6 +51,7 @@ or add to your Gemfile:
|
|
51
51
|
# Gemfile
|
52
52
|
gem 'rabl'
|
53
53
|
# Also add either `oj` or `yajl-ruby` as the JSON parser
|
54
|
+
# If using `oj`, Rabl will set the mode to :compat
|
54
55
|
gem 'oj'
|
55
56
|
```
|
56
57
|
|
data/lib/rabl/builder.rb
CHANGED
@@ -153,6 +153,7 @@ module Rabl
|
|
153
153
|
# node(:foo, :if => lambda { |m| m.foo.present? }) { "bar" }
|
154
154
|
def node(name, options = {}, &block)
|
155
155
|
return unless resolve_condition(options)
|
156
|
+
return if @options.has_key?(:except) && [@options[:except]].flatten.include?(name)
|
156
157
|
|
157
158
|
result = block.call(@_object)
|
158
159
|
if name.present?
|
data/lib/rabl/digestor/rails3.rb
CHANGED
data/lib/rabl/digestor/rails5.rb
CHANGED
data/lib/rabl/digestor.rb
CHANGED
data/lib/rabl/engine.rb
CHANGED
@@ -62,7 +62,7 @@ module Rabl
|
|
62
62
|
template = @_options[:template] || @virtual_path
|
63
63
|
|
64
64
|
digest =
|
65
|
-
if Rails.version.to_s =~ /^[
|
65
|
+
if Rails.version.to_s =~ /^[67]/
|
66
66
|
Digestor.digest(name: template, finder: lookup_context, format: :rabl)
|
67
67
|
elsif Gem::Version.new(Rails.version) >= Gem::Version.new('4.1')
|
68
68
|
Digestor.digest(:name => template, :finder => lookup_context)
|
@@ -356,8 +356,8 @@ module Rabl
|
|
356
356
|
end
|
357
357
|
|
358
358
|
# Supports calling helpers defined for the template context_scope using method_missing hook
|
359
|
-
def method_missing(name, *args, &block)
|
360
|
-
context_scope.respond_to?(name, true) ? context_scope.__send__(name, *args, &block) : super
|
359
|
+
def method_missing(name, *args, **kwargs, &block)
|
360
|
+
context_scope.respond_to?(name, true) ? context_scope.__send__(name, *args, **kwargs, &block) : super
|
361
361
|
end
|
362
362
|
|
363
363
|
def copy_instance_variables_from(object, exclude = []) #:nodoc:
|
@@ -393,7 +393,7 @@ module Rabl
|
|
393
393
|
end
|
394
394
|
|
395
395
|
def digestor_available?
|
396
|
-
defined?(Rails) && Rails.version =~ /^[
|
396
|
+
defined?(Rails) && Rails.version =~ /^[4567]/
|
397
397
|
end
|
398
398
|
|
399
399
|
def valid_format?(format)
|
data/lib/rabl/railtie.rb
CHANGED
@@ -22,7 +22,7 @@ module Rabl
|
|
22
22
|
Rabl.register!
|
23
23
|
|
24
24
|
# Inject dependency tracker for :rabl
|
25
|
-
if Rails.version =~ /^[
|
25
|
+
if Rails.version =~ /^[4567]/
|
26
26
|
require 'action_view/dependency_tracker'
|
27
27
|
ActionView::DependencyTracker.register_tracker :rabl, Rabl::Tracker
|
28
28
|
end
|
data/lib/rabl/template.rb
CHANGED
@@ -62,8 +62,8 @@ if defined?(ActionView) && defined?(Rails) && Rails.respond_to?(:version) && Rai
|
|
62
62
|
ActionView::Template.register_template_handler :rabl, ActionView::Template::Handlers::Rabl
|
63
63
|
end
|
64
64
|
|
65
|
-
# Rails 6.X Template
|
66
|
-
if defined?(ActionView) && defined?(Rails) && Rails.respond_to?(:version) && Rails.version.to_s =~ /^[
|
65
|
+
# Rails 6.X / 7.X Template
|
66
|
+
if defined?(ActionView) && defined?(Rails) && Rails.respond_to?(:version) && Rails.version.to_s =~ /^[67]/
|
67
67
|
module ActionView
|
68
68
|
module Template::Handlers
|
69
69
|
class Rabl
|
data/lib/rabl/version.rb
CHANGED
data/lib/rabl.rb
CHANGED
@@ -17,9 +17,9 @@ require 'rabl/renderer'
|
|
17
17
|
require 'rabl/cache_engine'
|
18
18
|
|
19
19
|
if defined?(Rails) && Rails.respond_to?(:version)
|
20
|
-
require 'rabl/tracker' if Rails.version =~ /^[
|
21
|
-
require 'rabl/digestor' if Rails.version =~ /^[
|
22
|
-
require 'rabl/railtie' if Rails.version =~ /^[
|
20
|
+
require 'rabl/tracker' if Rails.version =~ /^[4567]/
|
21
|
+
require 'rabl/digestor' if Rails.version =~ /^[4567]/
|
22
|
+
require 'rabl/railtie' if Rails.version =~ /^[34567]/
|
23
23
|
end
|
24
24
|
|
25
25
|
# Rabl.register!
|
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.
|
4
|
+
version: 0.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Esquenazi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: rr
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|