activesupport 5.1.3 → 5.1.4.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of activesupport might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a9503cbf1dbcaa8aa03f6d1f4a1667856879552a
4
- data.tar.gz: eba8c850d0fc2c7c932b64ec8c00c6f37ac58626
3
+ metadata.gz: b960543d225b135e4d04d05db62be2f2b0df1947
4
+ data.tar.gz: fbd71c160bc96d9cc9c5a6074ed2be362acfecb7
5
5
  SHA512:
6
- metadata.gz: c66989275ecc5adddfbe7ded4f8f4f2f924d64fa1324796e4d75ae2291e12fa390b9b6a69b657920dc4dd539698f598918b71e67661d842c8b68a0bc3b8e598e
7
- data.tar.gz: 2bc6f6b33131c2fbd63939b2d0b4d7332f6ae62984eb01632ffe5c901b10118e5496ff8445a6a198d19d024d719ca66cab8056e1cdc11d7647ac50b5e71026d9
6
+ metadata.gz: 7d4249cf68d8a0081fb5a05ec758964cd5ada46730341b66fea1d4e05d7948faac1cdda776af272a80be2da029b536b4bcf89c111c74cbeee00ee8472cbde194
7
+ data.tar.gz: 17a8135d545e232093dadbe336dc57bf02233da057011f6887a6218c9a1a5a1a8a125da1e516acdfa37fb001bb2b103c97482aceeae3422518c59482cfe23c91
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## Rails 5.1.4.rc1 (August 24, 2017) ##
2
+
3
+ * No changes.
4
+
5
+
1
6
  ## Rails 5.1.3 (August 03, 2017) ##
2
7
 
3
8
  * No changes.
@@ -7,8 +7,8 @@ module ActiveSupport
7
7
  module VERSION
8
8
  MAJOR = 5
9
9
  MINOR = 1
10
- TINY = 3
11
- PRE = nil
10
+ TINY = 4
11
+ PRE = "rc1"
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  end
@@ -221,7 +221,7 @@ module ActiveSupport
221
221
  # dup = hash.dup
222
222
  # dup[:a][:c] = 'c'
223
223
  #
224
- # hash[:a][:c] # => nil
224
+ # hash[:a][:c] # => "c"
225
225
  # dup[:a][:c] # => "c"
226
226
  def dup
227
227
  self.class.new(self).tap do |new_hash|
@@ -25,33 +25,51 @@ module ActiveSupport
25
25
  base.class_eval do
26
26
  @load_hooks = Hash.new { |h, k| h[k] = [] }
27
27
  @loaded = Hash.new { |h, k| h[k] = [] }
28
+ @run_once = Hash.new { |h, k| h[k] = [] }
28
29
  end
29
30
  end
30
31
 
31
32
  # Declares a block that will be executed when a Rails component is fully
32
33
  # loaded.
34
+ #
35
+ # Options:
36
+ #
37
+ # * <tt>:yield</tt> - Yields the object that run_load_hooks to +block+.
38
+ # * <tt>:run_once</tt> - Given +block+ will run only once.
33
39
  def on_load(name, options = {}, &block)
34
40
  @loaded[name].each do |base|
35
- execute_hook(base, options, block)
41
+ execute_hook(name, base, options, block)
36
42
  end
37
43
 
38
44
  @load_hooks[name] << [block, options]
39
45
  end
40
46
 
41
- def execute_hook(base, options, block)
42
- if options[:yield]
43
- block.call(base)
44
- else
45
- base.instance_eval(&block)
46
- end
47
- end
48
-
49
47
  def run_load_hooks(name, base = Object)
50
48
  @loaded[name] << base
51
49
  @load_hooks[name].each do |hook, options|
52
- execute_hook(base, options, hook)
50
+ execute_hook(name, base, options, hook)
53
51
  end
54
52
  end
53
+
54
+ private
55
+
56
+ def with_execution_control(name, block, once)
57
+ unless @run_once[name].include?(block)
58
+ @run_once[name] << block if once
59
+
60
+ yield
61
+ end
62
+ end
63
+
64
+ def execute_hook(name, base, options, block)
65
+ with_execution_control(name, block, options[:run_once]) do
66
+ if options[:yield]
67
+ block.call(base)
68
+ else
69
+ base.instance_eval(&block)
70
+ end
71
+ end
72
+ end
55
73
  end
56
74
 
57
75
  extend LazyLoadHooks
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activesupport
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.3
4
+ version: 5.1.4.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-03 00:00:00.000000000 Z
11
+ date: 2017-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -327,9 +327,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
327
327
  version: 2.2.2
328
328
  required_rubygems_version: !ruby/object:Gem::Requirement
329
329
  requirements:
330
- - - ">="
330
+ - - ">"
331
331
  - !ruby/object:Gem::Version
332
- version: '0'
332
+ version: 1.3.1
333
333
  requirements: []
334
334
  rubyforge_project:
335
335
  rubygems_version: 2.6.12