update to 2.11.5
This commit is contained in:
parent
68eac285bb
commit
a0cb532ed3
@ -1,85 +0,0 @@
|
||||
From 454d69729ffbde221117992a805f70d3a39b5ba4 Mon Sep 17 00:00:00 2001
|
||||
From: r7kamura <r7kamura@gmail.com>
|
||||
Date: Tue, 29 Oct 2019 13:26:47 +0900
|
||||
Subject: [PATCH] Fix warnings on Ruby 2.7
|
||||
|
||||
> warning: Capturing the given block using Proc.new is deprecated; use `&block` instead
|
||||
|
||||
This patch converts `Proc.new` calls into `&block`.
|
||||
---
|
||||
lib/jbuilder.rb | 16 ++++++++--------
|
||||
lib/jbuilder/jbuilder_template.rb | 4 ++--
|
||||
2 files changed, 10 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/lib/jbuilder.rb b/lib/jbuilder.rb
|
||||
index f062a00..086d5ac 100644
|
||||
--- a/lib/jbuilder.rb
|
||||
+++ b/lib/jbuilder.rb
|
||||
@@ -26,12 +26,12 @@ def self.encode(*args, &block)
|
||||
BLANK = Blank.new
|
||||
NON_ENUMERABLES = [ ::Struct, ::OpenStruct ].to_set
|
||||
|
||||
- def set!(key, value = BLANK, *args)
|
||||
+ def set!(key, value = BLANK, *args, &block)
|
||||
result = if ::Kernel.block_given?
|
||||
if !_blank?(value)
|
||||
# json.comments @post.comments { |comment| ... }
|
||||
# { "comments": [ { ... }, { ... } ] }
|
||||
- _scope{ array! value, &::Proc.new }
|
||||
+ _scope{ array! value, &block }
|
||||
else
|
||||
# json.comments { ... }
|
||||
# { "comments": ... }
|
||||
@@ -61,9 +61,9 @@ def set!(key, value = BLANK, *args)
|
||||
_set_value key, result
|
||||
end
|
||||
|
||||
- def method_missing(*args)
|
||||
+ def method_missing(*args, &block)
|
||||
if ::Kernel.block_given?
|
||||
- set!(*args, &::Proc.new)
|
||||
+ set!(*args, &block)
|
||||
else
|
||||
set!(*args)
|
||||
end
|
||||
@@ -181,11 +181,11 @@ def child!
|
||||
# json.array! [1, 2, 3]
|
||||
#
|
||||
# [1,2,3]
|
||||
- def array!(collection = [], *attributes)
|
||||
+ def array!(collection = [], *attributes, &block)
|
||||
array = if collection.nil?
|
||||
[]
|
||||
elsif ::Kernel.block_given?
|
||||
- _map_collection(collection, &::Proc.new)
|
||||
+ _map_collection(collection, &block)
|
||||
elsif attributes.any?
|
||||
_map_collection(collection) { |element| extract! element, *attributes }
|
||||
else
|
||||
@@ -220,9 +220,9 @@ def extract!(object, *attributes)
|
||||
end
|
||||
end
|
||||
|
||||
- def call(object, *attributes)
|
||||
+ def call(object, *attributes, &block)
|
||||
if ::Kernel.block_given?
|
||||
- array! object, &::Proc.new
|
||||
+ array! object, &block
|
||||
else
|
||||
extract! object, *attributes
|
||||
end
|
||||
diff --git a/lib/jbuilder/jbuilder_template.rb b/lib/jbuilder/jbuilder_template.rb
|
||||
index 685922e..4162310 100644
|
||||
--- a/lib/jbuilder/jbuilder_template.rb
|
||||
+++ b/lib/jbuilder/jbuilder_template.rb
|
||||
@@ -73,8 +73,8 @@ def cache_root!(key=nil, options={})
|
||||
# json.cache_if! !admin?, @person, expires_in: 10.minutes do
|
||||
# json.extract! @person, :name, :age
|
||||
# end
|
||||
- def cache_if!(condition, *args)
|
||||
- condition ? cache!(*args, &::Proc.new) : yield
|
||||
+ def cache_if!(condition, *args, &block)
|
||||
+ condition ? cache!(*args, &block) : yield
|
||||
end
|
||||
|
||||
def target!
|
||||
BIN
jbuilder-2.11.5.gem
Normal file
BIN
jbuilder-2.11.5.gem
Normal file
Binary file not shown.
Binary file not shown.
@ -1,12 +0,0 @@
|
||||
diff -Nur a/test/jbuilder_template_test.rb b/test/jbuilder_template_test.rb
|
||||
--- a/test/jbuilder_template_test.rb 2022-03-01 17:35:46.095179949 +0800
|
||||
+++ b/test/jbuilder_template_test.rb 2022-03-01 17:35:24.366810725 +0800
|
||||
@@ -290,7 +290,7 @@
|
||||
|
||||
def render_without_parsing(source, assigns = {})
|
||||
view = build_view(fixtures: PARTIALS.merge("source.json.jbuilder" => source), assigns: assigns)
|
||||
- view.render(template: "source.json.jbuilder")
|
||||
+ view.render(template: "source")
|
||||
end
|
||||
|
||||
def build_view(options = {})
|
||||
@ -1,13 +1,11 @@
|
||||
%global gem_name jbuilder
|
||||
Name: rubygem-%{gem_name}
|
||||
Version: 2.9.0
|
||||
Version: 2.11.5
|
||||
Release: 1
|
||||
Summary: Create JSON structures via a Builder-style DSL
|
||||
License: MIT
|
||||
URL: https://github.com/rails/jbuilder
|
||||
Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem
|
||||
Patch1: rubygem-jbuilder-2.9.0-Fixes-the-test-suite-in-Rails-6-1.patch
|
||||
Patch2: Fix-warnings-on-Ruby-2.7.patch
|
||||
BuildRequires: ruby(release) rubygems-devel ruby rubygem(activemodel) rubygem(multi_json)
|
||||
BuildRequires: rubygem(mocha) rubygem(railties)
|
||||
BuildArch: noarch
|
||||
@ -27,10 +25,6 @@ Documentation for %{name}.
|
||||
%prep
|
||||
%setup -q -c -T
|
||||
%gem_install -n %{SOURCE0}
|
||||
pushd .%{gem_instdir}
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
popd
|
||||
|
||||
%build
|
||||
|
||||
@ -55,7 +49,6 @@ popd
|
||||
|
||||
%files doc
|
||||
%doc %{gem_docdir}
|
||||
%doc %{gem_instdir}/CHANGELOG.md
|
||||
%doc %{gem_instdir}/CONTRIBUTING.md
|
||||
%{gem_instdir}/Gemfile
|
||||
%doc %{gem_instdir}/README.md
|
||||
@ -66,6 +59,9 @@ popd
|
||||
%{gem_instdir}/Appraisals
|
||||
|
||||
%changelog
|
||||
* Sat Jan 28 2023 wangkai <wangkai385@h-partners.com> - 2.11.5-1
|
||||
- update to 2.11.5
|
||||
|
||||
* Thu Mar 3 2022 liqiuyu <liqiuyu@kylinos.cn> - 2.9.0-1
|
||||
- update to 2.9.0
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user