activesupport 4.2.3 → 4.2.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: 46fbf1c62f18bdf31773979343812bd19aa1ed51
4
- data.tar.gz: e9d42d3b39f078d9033b89d711dbb77ae59bb903
3
+ metadata.gz: 34fda234762c40af2ad38b4c2d10c5329e4d3739
4
+ data.tar.gz: db898bea7fa4ee4ebbe2a7d832d85e489dee3551
5
5
  SHA512:
6
- metadata.gz: a96a150c6253672eb1b0e94d264207a2846e45a0ad5701c81fda99d4029299402a906b96fa048d6d7c6a46c6201a0e28850c5c19b656cf4e855b2bb5f6f31e37
7
- data.tar.gz: d382b3a4f6d845bfc049df7572678223a19252050781c4e5952cbee7fd778327fde8669bbd3c24f379087fd59fa4aef3fbe559e3b6be0d603785a56a5382e6cb
6
+ metadata.gz: 1cbb36d1275fbeb38d82dfa2369eb4eadf6e78061bc638c5afbc55127ed34cbdeef19631eacd645dfce0035a880d0e45e010ee8bbfa3ad3b63358eae5470f88f
7
+ data.tar.gz: 39de2f010f598544acadaa6c86c74e513ab856aa6307a4a3c0761355c55de4115a50d80dd5892e8833250164febe54984e62ac63f2f3cec9ec3f3623dddb45c4
@@ -1,3 +1,22 @@
1
+ ## Rails 4.2.4 (August 14, 2015) ##
2
+
3
+ * Fix a `SystemStackError` when encoding an `Enumerable` with `json` gem and
4
+ with the Active Support JSON encoder loaded.
5
+
6
+ Fixes #20775.
7
+
8
+ *Sammy Larbi*, *Prathamesh Sonpatki*
9
+
10
+ * Fix not calling `#default` on `HashWithIndifferentAcess#to_hash` when only
11
+ `default_proc` is set, which could raise.
12
+
13
+ *Simon Eskildsen*
14
+
15
+ * Fix setting `default_proc` on `HashWithIndifferentAccess#dup`
16
+
17
+ *Simon Eskildsen*
18
+
19
+
1
20
  ## Rails 4.2.3 (June 25, 2015) ##
2
21
 
3
22
  * Fix a range of values for parameters of the Time#change
@@ -78,8 +78,12 @@ module ActiveSupport
78
78
  # save
79
79
  # end
80
80
  def run_callbacks(kind, &block)
81
- callbacks = send("_#{kind}_callbacks")
81
+ send "_run_#{kind}_callbacks", &block
82
+ end
83
+
84
+ private
82
85
 
86
+ def __run_callbacks__(callbacks, &block)
83
87
  if callbacks.empty?
84
88
  yield if block_given?
85
89
  else
@@ -89,8 +93,6 @@ module ActiveSupport
89
93
  end
90
94
  end
91
95
 
92
- private
93
-
94
96
  # A hook invoked every time a before callback is halted.
95
97
  # This can be overridden in AS::Callback implementors in order
96
98
  # to provide better debugging/logging.
@@ -770,6 +772,12 @@ module ActiveSupport
770
772
  names.each do |name|
771
773
  class_attribute "_#{name}_callbacks"
772
774
  set_callbacks name, CallbackChain.new(name, options)
775
+
776
+ module_eval <<-RUBY, __FILE__, __LINE__ + 1
777
+ def _run_#{name}_callbacks(&block)
778
+ __run_callbacks__(_#{name}_callbacks, &block)
779
+ end
780
+ RUBY
773
781
  end
774
782
  end
775
783
 
@@ -26,7 +26,7 @@ require 'active_support/core_ext/module/aliasing'
26
26
  # bypassed completely. This means that as_json won't be invoked and the JSON gem will simply
27
27
  # ignore any options it does not natively understand. This also means that ::JSON.{generate,dump}
28
28
  # should give exactly the same results with or without active support.
29
- [Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass, Enumerable].each do |klass|
29
+ [Enumerable, Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass].each do |klass|
30
30
  klass.class_eval do
31
31
  def to_json_with_active_support_encoder(options = nil) # :nodoc:
32
32
  if options.is_a?(::JSON::State)
@@ -104,6 +104,12 @@ class Time
104
104
  # takes a hash with any of these keys: <tt>:years</tt>, <tt>:months</tt>,
105
105
  # <tt>:weeks</tt>, <tt>:days</tt>, <tt>:hours</tt>, <tt>:minutes</tt>,
106
106
  # <tt>:seconds</tt>.
107
+ #
108
+ # Time.new(2015, 8, 1, 14, 35, 0).advance(seconds: 1) # => 2015-08-01 14:35:01 -0700
109
+ # Time.new(2015, 8, 1, 14, 35, 0).advance(minutes: 1) # => 2015-08-01 14:36:00 -0700
110
+ # Time.new(2015, 8, 1, 14, 35, 0).advance(hours: 1) # => 2015-08-01 15:35:00 -0700
111
+ # Time.new(2015, 8, 1, 14, 35, 0).advance(days: 1) # => 2015-08-02 14:35:00 -0700
112
+ # Time.new(2015, 8, 1, 14, 35, 0).advance(weeks: 1) # => 2015-08-08 14:35:00 -0700
107
113
  def advance(options)
108
114
  unless options[:weeks].nil?
109
115
  options[:weeks], partial_weeks = options[:weeks].divmod(1)
@@ -7,8 +7,8 @@ module ActiveSupport
7
7
  module VERSION
8
8
  MAJOR = 4
9
9
  MINOR = 2
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
@@ -188,7 +188,7 @@ module ActiveSupport
188
188
  # dup[:a][:c] # => "c"
189
189
  def dup
190
190
  self.class.new(self).tap do |new_hash|
191
- new_hash.default = default
191
+ set_defaults(new_hash)
192
192
  end
193
193
  end
194
194
 
@@ -247,7 +247,9 @@ module ActiveSupport
247
247
 
248
248
  # Convert to a regular hash with string keys.
249
249
  def to_hash
250
- _new_hash = Hash.new(default)
250
+ _new_hash = Hash.new
251
+ set_defaults(_new_hash)
252
+
251
253
  each do |key, value|
252
254
  _new_hash[key] = convert_value(value, for: :to_hash)
253
255
  end
@@ -275,6 +277,14 @@ module ActiveSupport
275
277
  value
276
278
  end
277
279
  end
280
+
281
+ def set_defaults(target)
282
+ if default_proc
283
+ target.default_proc = default_proc.dup
284
+ else
285
+ target.default = default
286
+ end
287
+ end
278
288
  end
279
289
  end
280
290
 
@@ -111,7 +111,7 @@ module ActiveSupport
111
111
  end
112
112
  end
113
113
 
114
- class Timed < Evented
114
+ class Timed < Evented # :nodoc:
115
115
  def publish(name, *args)
116
116
  @delegate.call name, *args
117
117
  end
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: 4.2.3
4
+ version: 4.2.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: 2015-06-25 00:00:00.000000000 Z
11
+ date: 2015-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -334,14 +334,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
334
334
  version: 1.9.3
335
335
  required_rubygems_version: !ruby/object:Gem::Requirement
336
336
  requirements:
337
- - - ">="
337
+ - - ">"
338
338
  - !ruby/object:Gem::Version
339
- version: '0'
339
+ version: 1.3.1
340
340
  requirements: []
341
341
  rubyforge_project:
342
- rubygems_version: 2.4.5
342
+ rubygems_version: 2.4.7
343
343
  signing_key:
344
344
  specification_version: 4
345
345
  summary: A toolkit of support libraries and Ruby core extensions extracted from the
346
346
  Rails framework.
347
347
  test_files: []
348
+ has_rdoc: