activesupport 5.0.5 → 5.0.6.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: 41ace0ff3b6e30b3c960421507f5da775e6e0627
4
- data.tar.gz: 4451aa6a40a2d2f9edbad20459f6aafcad6d639d
3
+ metadata.gz: b0b05ea535f84f3f2a8e8774774d2d9634fed81e
4
+ data.tar.gz: ae29afaa002ad64a2288029041d00ce9035b0de3
5
5
  SHA512:
6
- metadata.gz: 8c63908f5f4ee554604bdbe6b9234aa56a828f577a4fb8d639f42353d04b6978065683ffeb648a40524672ddb00c2a9bfebe341fc2e45dedd63ddd3315e46c7b
7
- data.tar.gz: fb342f60a13b99283a660aa31eef96962ab4c5d3784c19c3a2559ea62379758d326bdd422ab97068d72361ac87108b3c4162ca760668ad51ed8d01473be16505
6
+ metadata.gz: f6d86323de362506d77eba428ae1e0d7ab2f5d418c4ff40b37ede75f4300618cac2c66327161e71b3b553e9c14d8d3ba0134bf7576840179d5f0cf551ed3ec39
7
+ data.tar.gz: 34458926f43d31d48a7132af49cafadf3886bf2da816720c4fac1cb2f6a7bc695ee1d3ec72bf9fd90ab55a369bfbd86366619c2036b743e9823e0b7a7e5cd95e
@@ -1,3 +1,8 @@
1
+ ## Rails 5.0.6.rc1 (August 24, 2017) ##
2
+
3
+ * No changes.
4
+
5
+
1
6
  ## Rails 5.0.5 (July 31, 2017) ##
2
7
 
3
8
  * No changes.
@@ -7,8 +7,8 @@ module ActiveSupport
7
7
  module VERSION
8
8
  MAJOR = 5
9
9
  MINOR = 0
10
- TINY = 5
11
- PRE = nil
10
+ TINY = 6
11
+ PRE = "rc1"
12
12
 
13
13
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
14
14
  end
@@ -211,7 +211,7 @@ module ActiveSupport
211
211
  # dup = hash.dup
212
212
  # dup[:a][:c] = 'c'
213
213
  #
214
- # hash[:a][:c] # => nil
214
+ # hash[:a][:c] # => "c"
215
215
  # dup[:a][:c] # => "c"
216
216
  def dup
217
217
  self.class.new(self).tap do |new_hash|
@@ -23,33 +23,53 @@ module ActiveSupport
23
23
  module LazyLoadHooks
24
24
  def self.extended(base) # :nodoc:
25
25
  base.class_eval do
26
- @load_hooks = Hash.new { |h,k| h[k] = [] }
27
- @loaded = Hash.new { |h,k| h[k] = [] }
26
+ @load_hooks = Hash.new { |h, k| h[k] = [] }
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
 
32
+ # Declares a block that will be executed when a Rails component is fully
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.
31
39
  def on_load(name, options = {}, &block)
32
40
  @loaded[name].each do |base|
33
- execute_hook(base, options, block)
41
+ execute_hook(name, base, options, block)
34
42
  end
35
43
 
36
44
  @load_hooks[name] << [block, options]
37
45
  end
38
46
 
39
- def execute_hook(base, options, block)
40
- if options[:yield]
41
- block.call(base)
42
- else
43
- base.instance_eval(&block)
44
- end
45
- end
46
-
47
47
  def run_load_hooks(name, base = Object)
48
48
  @loaded[name] << base
49
49
  @load_hooks[name].each do |hook, options|
50
- execute_hook(base, options, hook)
50
+ execute_hook(name, base, options, hook)
51
51
  end
52
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
53
73
  end
54
74
 
55
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.0.5
4
+ version: 5.0.6.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-07-31 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
@@ -331,9 +331,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
331
331
  version: 2.2.2
332
332
  required_rubygems_version: !ruby/object:Gem::Requirement
333
333
  requirements:
334
- - - ">="
334
+ - - ">"
335
335
  - !ruby/object:Gem::Version
336
- version: '0'
336
+ version: 1.3.1
337
337
  requirements: []
338
338
  rubyforge_project:
339
339
  rubygems_version: 2.6.12