jbuilder 2.2.11 → 2.2.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d378effeff78ae44875038cba11cbfddf21e6200
4
- data.tar.gz: 340055def67dc3c0339d7e23f9fb7faf155ead92
3
+ metadata.gz: e20ebff9d84c8c417da4626184d5c0360d96039c
4
+ data.tar.gz: 73e44d30685bdd6db5655c8cd3c6c6e5087f21e6
5
5
  SHA512:
6
- metadata.gz: 00a08de474d1d1ef4596a38c26d70a210cd58400397e85ffbeaf4d33b702ad176929372bf08eb17e854358eb1fd1bc3b7c34b9bcf4a8d553ca26ae520607f18a
7
- data.tar.gz: 618d79b7be67c13317f262a95bc56e8c761af8e162e267f89949980f5a00749d8136e5017b1b325071760ad8a0cf3c335a18b5c2cd9792f7a4d2f0cb4465dc37
6
+ metadata.gz: 4447541e8d14944f440ff55d1bdc88a2b64a14aadcf43de76aaa1ae308e430ceadb25e9bd60707963655ef407b9b27b5f6eaa298bc5b800e6392736cee3d3847
7
+ data.tar.gz: 87ec45135f3d1fb89f20cc51b51e9f62cf69b270af5ef55fe52e5706aac70da2799b4f5b71e584816e74a2727703a6471e3370e4589e81a79599727caa01db66
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ 2.2.12
4
+ ------
5
+
6
+ * [Replace explici block calls with yield for performance](https://github.com/rails/jbuilder/commit/3184f941276ad03a071cf977133d1a32302afa47)
7
+
3
8
  2.2.11
4
9
  ------
5
10
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'jbuilder'
3
- s.version = '2.2.11'
3
+ s.version = '2.2.12'
4
4
  s.authors = ['David Heinemeier Hansson', 'Pavel Pravosud']
5
5
  s.email = ['david@37signals.com', 'pavel@pravosud.com']
6
6
  s.summary = 'Create JSON structures via a Builder-style DSL'
@@ -18,18 +18,18 @@ class Jbuilder
18
18
  end
19
19
 
20
20
  # Yields a builder and automatically turns the result into a JSON string
21
- def self.encode(*args, &block)
22
- new(*args, &block).target!
21
+ def self.encode(*args)
22
+ new(*args, &::Proc.new).target!
23
23
  end
24
24
 
25
25
  BLANK = Blank.new
26
26
 
27
- def set!(key, value = BLANK, *args, &block)
28
- result = if block
27
+ def set!(key, value = BLANK, *args)
28
+ result = if ::Kernel.block_given?
29
29
  if !_blank?(value)
30
30
  # json.comments @post.comments { |comment| ... }
31
31
  # { "comments": [ { ... }, { ... } ] }
32
- _scope{ array! value, &block }
32
+ _scope{ array! value, &::Proc.new }
33
33
  else
34
34
  # json.comments { ... }
35
35
  # { "comments": ... }
@@ -174,11 +174,11 @@ class Jbuilder
174
174
  # json.array! [1, 2, 3]
175
175
  #
176
176
  # [1,2,3]
177
- def array!(collection = [], *attributes, &block)
177
+ def array!(collection = [], *attributes)
178
178
  array = if collection.nil?
179
179
  []
180
- elsif block
181
- _map_collection(collection, &block)
180
+ elsif ::Kernel.block_given?
181
+ _map_collection(collection, &::Proc.new)
182
182
  elsif attributes.any?
183
183
  _map_collection(collection) { |element| extract! element, *attributes }
184
184
  else
@@ -213,9 +213,9 @@ class Jbuilder
213
213
  end
214
214
  end
215
215
 
216
- def call(object, *attributes, &block)
217
- if block
218
- array! object, &block
216
+ def call(object, *attributes)
217
+ if ::Kernel.block_given?
218
+ array! object, &::Proc.new
219
219
  else
220
220
  extract! object, *attributes
221
221
  end
@@ -9,9 +9,9 @@ class JbuilderTemplate < Jbuilder
9
9
 
10
10
  self.template_lookup_options = { handlers: [:jbuilder] }
11
11
 
12
- def initialize(context, *args, &block)
12
+ def initialize(context, *args)
13
13
  @context = context
14
- super(*args, &block)
14
+ super(*args)
15
15
  end
16
16
 
17
17
  def partial!(name_or_options, locals = {})
@@ -74,8 +74,8 @@ class JbuilderTemplate < Jbuilder
74
74
  # json.cache_if! !admin?, @person, expires_in: 10.minutes do
75
75
  # json.extract! @person, :name, :age
76
76
  # end
77
- def cache_if!(condition, *args, &block)
78
- condition ? cache!(*args, &block) : yield
77
+ def cache_if!(condition, *args)
78
+ condition ? cache!(*args, &::Proc.new) : yield
79
79
  end
80
80
 
81
81
  protected
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jbuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.11
4
+ version: 2.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-03-07 00:00:00.000000000 Z
12
+ date: 2015-03-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport