activesupport 5.0.0.1 → 5.0.1.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 +4 -4
- data/CHANGELOG.md +97 -0
- data/README.rdoc +1 -1
- data/lib/active_support/cache/mem_cache_store.rb +1 -1
- data/lib/active_support/concurrency/latch.rb +12 -5
- data/lib/active_support/concurrency/share_lock.rb +45 -5
- data/lib/active_support/core_ext/date_and_time/calculations.rb +1 -1
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +5 -1
- data/lib/active_support/core_ext/load_error.rb +2 -1
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +6 -6
- data/lib/active_support/dependencies/interlock.rb +4 -0
- data/lib/active_support/deprecation/instance_delegator.rb +13 -0
- data/lib/active_support/duration.rb +3 -2
- data/lib/active_support/execution_wrapper.rb +21 -12
- data/lib/active_support/gem_version.rb +2 -2
- data/lib/active_support/hash_with_indifferent_access.rb +6 -0
- data/lib/active_support/lazy_load_hooks.rb +26 -18
- data/lib/active_support/logger.rb +2 -2
- data/lib/active_support/message_encryptor.rb +7 -0
- data/lib/active_support/rescuable.rb +3 -1
- data/lib/active_support/tagged_logging.rb +5 -6
- data/lib/active_support/test_case.rb +2 -0
- data/lib/active_support/testing/autorun.rb +4 -7
- data/lib/active_support/time_with_zone.rb +2 -1
- data/lib/active_support/values/time_zone.rb +1 -0
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c375c69242d5ab75d4f3bbf673f738616b1f8a0
|
4
|
+
data.tar.gz: 9728a0c0c46561a3576e9288bb89856fb8c4e222
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45866bc249048192346191559953a6c6c2244023c6d24158adb98990416a1b45699ebc774d29e45b555cb4f6737ff39aa929d0c7a390cca23be03573b46f3a79
|
7
|
+
data.tar.gz: b080cfbb70295e602ffa01e0546300804593dc3af4458e852b56dd6354f84d33deaaea393935d750f4b1ccdfc0761b4e4cb2325dcba04c6c731d95527a16c152
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,100 @@
|
|
1
|
+
## Rails 5.0.1.rc1 (December 01, 2016) ##
|
2
|
+
|
3
|
+
* Ensure duration parsing is consistent across DST changes
|
4
|
+
|
5
|
+
Previously `ActiveSupport::Duration.parse` used `Time.current` and
|
6
|
+
`Time#advance` to calculate the number of seconds in the duration
|
7
|
+
from an arbitrary collection of parts. However as `advance` tries to
|
8
|
+
be consistent across DST boundaries this meant that either the
|
9
|
+
duration was shorter or longer depending on the time of year.
|
10
|
+
|
11
|
+
This was fixed by using an absolute reference point in UTC which
|
12
|
+
isn't subject to DST transitions. An arbitrary date of Jan 1st, 2000
|
13
|
+
was chosen for no other reason that it seemed appropriate.
|
14
|
+
|
15
|
+
Additionally, duration parsing should now be marginally faster as we
|
16
|
+
are no longer creating instances of `ActiveSupport::TimeWithZone`
|
17
|
+
every time we parse a duration string.
|
18
|
+
|
19
|
+
Fixes #26941.
|
20
|
+
|
21
|
+
*Andrew White*
|
22
|
+
|
23
|
+
* Fix `DateAndTime::Calculations#copy_time_to`. Copy `nsec` instead of `usec`.
|
24
|
+
|
25
|
+
Jumping forward or backward between weeks now preserves nanosecond digits.
|
26
|
+
|
27
|
+
*Josua Schmid*
|
28
|
+
|
29
|
+
* Avoid bumping the class serial when invoking executor.
|
30
|
+
|
31
|
+
*Matthew Draper*
|
32
|
+
|
33
|
+
* Fix `ActiveSupport::TimeWithZone#in` across DST boundaries.
|
34
|
+
|
35
|
+
Previously calls to `in` were being sent to the non-DST aware
|
36
|
+
method `Time#since` via `method_missing`. It is now aliased to
|
37
|
+
the DST aware `ActiveSupport::TimeWithZone#+` which handles
|
38
|
+
transitions across DST boundaries, e.g:
|
39
|
+
|
40
|
+
Time.zone = "US/Eastern"
|
41
|
+
|
42
|
+
t = Time.zone.local(2016,11,6,1)
|
43
|
+
# => Sun, 06 Nov 2016 01:00:00 EDT -05:00
|
44
|
+
|
45
|
+
t.in(1.hour)
|
46
|
+
# => Sun, 06 Nov 2016 01:00:00 EST -05:00
|
47
|
+
|
48
|
+
Fixes #26580.
|
49
|
+
|
50
|
+
*Thomas Balthazar*
|
51
|
+
|
52
|
+
* Fix `thread_mattr_accessor` subclass no longer overwrites parent.
|
53
|
+
|
54
|
+
Assigning a value to a subclass using `thread_mattr_accessor` no
|
55
|
+
longer changes the value of the parent class. This brings the
|
56
|
+
behavior inline with the documentation.
|
57
|
+
|
58
|
+
Given:
|
59
|
+
|
60
|
+
class Account
|
61
|
+
thread_mattr_accessor :user
|
62
|
+
end
|
63
|
+
|
64
|
+
class Customer < Account
|
65
|
+
end
|
66
|
+
|
67
|
+
Account.user = "DHH"
|
68
|
+
Customer.user = "Rafael"
|
69
|
+
|
70
|
+
Before:
|
71
|
+
|
72
|
+
Account.user # => "Rafael"
|
73
|
+
|
74
|
+
After:
|
75
|
+
|
76
|
+
Account.user # => "DHH"
|
77
|
+
|
78
|
+
*Shinichi Maeshima*
|
79
|
+
|
80
|
+
* Since weeks are no longer converted to days, add `:weeks` to the list of
|
81
|
+
parts that `ActiveSupport::TimeWithZone` will recognize as possibly being
|
82
|
+
of variable duration to take account of DST transitions.
|
83
|
+
|
84
|
+
Fixes #26039.
|
85
|
+
|
86
|
+
*Andrew White*
|
87
|
+
|
88
|
+
* Fix `ActiveSupport::TimeZone#strptime`. Now raises `ArgumentError` when the
|
89
|
+
given time doesn't match the format. The error is the same as the one given
|
90
|
+
by Ruby's `Date.strptime`. Previously it raised
|
91
|
+
`NoMethodError: undefined method empty? for nil:NilClass.` due to a bug.
|
92
|
+
|
93
|
+
Fixes #25701.
|
94
|
+
|
95
|
+
*John Gesimondo*
|
96
|
+
|
97
|
+
|
1
98
|
## Rails 5.0.0 (June 30, 2016) ##
|
2
99
|
|
3
100
|
* Support parsing JSON time in ISO8601 local time strings in
|
data/README.rdoc
CHANGED
@@ -14,7 +14,7 @@ The latest version of Active Support can be installed with RubyGems:
|
|
14
14
|
|
15
15
|
Source code can be downloaded as part of the Rails project on GitHub:
|
16
16
|
|
17
|
-
* https://github.com/rails/rails/tree/
|
17
|
+
* https://github.com/rails/rails/tree/5-0-stable/activesupport
|
18
18
|
|
19
19
|
|
20
20
|
== License
|
@@ -97,7 +97,7 @@ module ActiveSupport
|
|
97
97
|
options = merged_options(options)
|
98
98
|
|
99
99
|
keys_to_names = Hash[names.map{|name| [normalize_key(name, options), name]}]
|
100
|
-
raw_values = @data.get_multi(keys_to_names.keys
|
100
|
+
raw_values = @data.get_multi(keys_to_names.keys)
|
101
101
|
values = {}
|
102
102
|
raw_values.each do |key, value|
|
103
103
|
entry = deserialize_entry(value)
|
@@ -2,17 +2,24 @@ require 'concurrent/atomic/count_down_latch'
|
|
2
2
|
|
3
3
|
module ActiveSupport
|
4
4
|
module Concurrency
|
5
|
-
class Latch
|
5
|
+
class Latch
|
6
6
|
|
7
7
|
def initialize(count = 1)
|
8
|
-
|
9
|
-
|
8
|
+
if count == 1
|
9
|
+
ActiveSupport::Deprecation.warn("ActiveSupport::Concurrency::Latch is deprecated. Please use Concurrent::Event instead.")
|
10
|
+
else
|
11
|
+
ActiveSupport::Deprecation.warn("ActiveSupport::Concurrency::Latch is deprecated. Please use Concurrent::CountDownLatch instead.")
|
12
|
+
end
|
13
|
+
|
14
|
+
@inner = Concurrent::CountDownLatch.new(count)
|
10
15
|
end
|
11
16
|
|
12
|
-
|
17
|
+
def release
|
18
|
+
@inner.count_down
|
19
|
+
end
|
13
20
|
|
14
21
|
def await
|
15
|
-
wait(nil)
|
22
|
+
@inner.wait(nil)
|
16
23
|
end
|
17
24
|
end
|
18
25
|
end
|
@@ -14,6 +14,38 @@ module ActiveSupport
|
|
14
14
|
# to upgrade share locks to exclusive.
|
15
15
|
|
16
16
|
|
17
|
+
def raw_state # :nodoc:
|
18
|
+
synchronize do
|
19
|
+
threads = @sleeping.keys | @sharing.keys | @waiting.keys
|
20
|
+
threads |= [@exclusive_thread] if @exclusive_thread
|
21
|
+
|
22
|
+
data = {}
|
23
|
+
|
24
|
+
threads.each do |thread|
|
25
|
+
purpose, compatible = @waiting[thread]
|
26
|
+
|
27
|
+
data[thread] = {
|
28
|
+
thread: thread,
|
29
|
+
sharing: @sharing[thread],
|
30
|
+
exclusive: @exclusive_thread == thread,
|
31
|
+
purpose: purpose,
|
32
|
+
compatible: compatible,
|
33
|
+
waiting: !!@waiting[thread],
|
34
|
+
sleeper: @sleeping[thread],
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# NB: Yields while holding our *internal* synchronize lock,
|
39
|
+
# which is supposed to be used only for a few instructions at
|
40
|
+
# a time. This allows the caller to inspect additional state
|
41
|
+
# without things changing out from underneath, but would have
|
42
|
+
# disastrous effects upon normal operation. Fortunately, this
|
43
|
+
# method is only intended to be called when things have
|
44
|
+
# already gone wrong.
|
45
|
+
yield data
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
17
49
|
def initialize
|
18
50
|
super()
|
19
51
|
|
@@ -21,6 +53,7 @@ module ActiveSupport
|
|
21
53
|
|
22
54
|
@sharing = Hash.new(0)
|
23
55
|
@waiting = {}
|
56
|
+
@sleeping = {}
|
24
57
|
@exclusive_thread = nil
|
25
58
|
@exclusive_depth = 0
|
26
59
|
end
|
@@ -46,7 +79,7 @@ module ActiveSupport
|
|
46
79
|
return false if no_wait
|
47
80
|
|
48
81
|
yield_shares(purpose: purpose, compatible: compatible, block_share: true) do
|
49
|
-
|
82
|
+
wait_for(:start_exclusive) { busy_for_exclusive?(purpose) }
|
50
83
|
end
|
51
84
|
end
|
52
85
|
@exclusive_thread = Thread.current
|
@@ -69,7 +102,7 @@ module ActiveSupport
|
|
69
102
|
|
70
103
|
if eligible_waiters?(compatible)
|
71
104
|
yield_shares(compatible: compatible, block_share: true) do
|
72
|
-
|
105
|
+
wait_for(:stop_exclusive) { @exclusive_thread || eligible_waiters?(compatible) }
|
73
106
|
end
|
74
107
|
end
|
75
108
|
@cv.broadcast
|
@@ -84,11 +117,11 @@ module ActiveSupport
|
|
84
117
|
elsif @waiting[Thread.current]
|
85
118
|
# We're nested inside a +yield_shares+ call: we'll resume as
|
86
119
|
# soon as there isn't an exclusive lock in our way
|
87
|
-
|
120
|
+
wait_for(:start_sharing) { @exclusive_thread }
|
88
121
|
else
|
89
122
|
# This is an initial / outermost share call: any outstanding
|
90
123
|
# requests for an exclusive lock get to go first
|
91
|
-
|
124
|
+
wait_for(:start_sharing) { busy_for_sharing?(false) }
|
92
125
|
end
|
93
126
|
@sharing[Thread.current] += 1
|
94
127
|
end
|
@@ -153,7 +186,7 @@ module ActiveSupport
|
|
153
186
|
yield
|
154
187
|
ensure
|
155
188
|
synchronize do
|
156
|
-
|
189
|
+
wait_for(:yield_shares) { @exclusive_thread && @exclusive_thread != Thread.current }
|
157
190
|
|
158
191
|
if previous_wait
|
159
192
|
@waiting[Thread.current] = previous_wait
|
@@ -181,6 +214,13 @@ module ActiveSupport
|
|
181
214
|
def eligible_waiters?(compatible)
|
182
215
|
@waiting.any? { |t, (p, _)| compatible.include?(p) && @waiting.all? { |t2, (_, c2)| t == t2 || c2.include?(p) } }
|
183
216
|
end
|
217
|
+
|
218
|
+
def wait_for(method)
|
219
|
+
@sleeping[Thread.current] = method
|
220
|
+
@cv.wait_while { yield }
|
221
|
+
ensure
|
222
|
+
@sleeping.delete Thread.current
|
223
|
+
end
|
184
224
|
end
|
185
225
|
end
|
186
226
|
end
|
@@ -12,7 +12,11 @@ module DateAndTime
|
|
12
12
|
mattr_accessor(:preserve_timezone, instance_writer: false) { false }
|
13
13
|
|
14
14
|
def to_time
|
15
|
-
preserve_timezone
|
15
|
+
if preserve_timezone
|
16
|
+
@_to_time_with_instance_offset ||= getlocal(utc_offset)
|
17
|
+
else
|
18
|
+
@_to_time_with_system_offset ||= getlocal
|
19
|
+
end
|
16
20
|
end
|
17
21
|
end
|
18
22
|
end
|
@@ -33,21 +33,21 @@ class Module
|
|
33
33
|
# end
|
34
34
|
#
|
35
35
|
# Current.new.user # => NoMethodError
|
36
|
-
def thread_mattr_reader(*syms)
|
36
|
+
def thread_mattr_reader(*syms) # :nodoc:
|
37
37
|
options = syms.extract_options!
|
38
38
|
|
39
39
|
syms.each do |sym|
|
40
40
|
raise NameError.new("invalid attribute name: #{sym}") unless sym =~ /^[_A-Za-z]\w*$/
|
41
41
|
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
42
42
|
def self.#{sym}
|
43
|
-
Thread.current[
|
43
|
+
Thread.current["attr_"+ name + "_#{sym}"]
|
44
44
|
end
|
45
45
|
EOS
|
46
46
|
|
47
47
|
unless options[:instance_reader] == false || options[:instance_accessor] == false
|
48
48
|
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
49
49
|
def #{sym}
|
50
|
-
Thread.current[
|
50
|
+
Thread.current["attr_"+ self.class.name + "_#{sym}"]
|
51
51
|
end
|
52
52
|
EOS
|
53
53
|
end
|
@@ -73,20 +73,20 @@ class Module
|
|
73
73
|
# end
|
74
74
|
#
|
75
75
|
# Current.new.user = "DHH" # => NoMethodError
|
76
|
-
def thread_mattr_writer(*syms)
|
76
|
+
def thread_mattr_writer(*syms) # :nodoc:
|
77
77
|
options = syms.extract_options!
|
78
78
|
syms.each do |sym|
|
79
79
|
raise NameError.new("invalid attribute name: #{sym}") unless sym =~ /^[_A-Za-z]\w*$/
|
80
80
|
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
81
81
|
def self.#{sym}=(obj)
|
82
|
-
Thread.current[
|
82
|
+
Thread.current["attr_"+ name + "_#{sym}"] = obj
|
83
83
|
end
|
84
84
|
EOS
|
85
85
|
|
86
86
|
unless options[:instance_writer] == false || options[:instance_accessor] == false
|
87
87
|
class_eval(<<-EOS, __FILE__, __LINE__ + 1)
|
88
88
|
def #{sym}=(obj)
|
89
|
-
Thread.current[
|
89
|
+
Thread.current["attr_"+ self.class.name + "_#{sym}"] = obj
|
90
90
|
end
|
91
91
|
EOS
|
92
92
|
end
|
@@ -6,6 +6,7 @@ module ActiveSupport
|
|
6
6
|
module InstanceDelegator # :nodoc:
|
7
7
|
def self.included(base)
|
8
8
|
base.extend(ClassMethods)
|
9
|
+
base.singleton_class.prepend(OverrideDelegators)
|
9
10
|
base.public_class_method :new
|
10
11
|
end
|
11
12
|
|
@@ -19,6 +20,18 @@ module ActiveSupport
|
|
19
20
|
singleton_class.delegate(method_name, to: :instance)
|
20
21
|
end
|
21
22
|
end
|
23
|
+
|
24
|
+
module OverrideDelegators # :nodoc:
|
25
|
+
def warn(message = nil, callstack = nil)
|
26
|
+
callstack ||= caller_locations(2)
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
30
|
+
def deprecation_warning(deprecated_method_name, message = nil, caller_backtrace = nil)
|
31
|
+
caller_backtrace ||= caller_locations(2)
|
32
|
+
super
|
33
|
+
end
|
34
|
+
end
|
22
35
|
end
|
23
36
|
end
|
24
37
|
end
|
@@ -7,6 +7,8 @@ module ActiveSupport
|
|
7
7
|
#
|
8
8
|
# 1.month.ago # equivalent to Time.now.advance(months: -1)
|
9
9
|
class Duration
|
10
|
+
EPOCH = ::Time.utc(2000)
|
11
|
+
|
10
12
|
attr_accessor :value, :parts
|
11
13
|
|
12
14
|
autoload :ISO8601Parser, 'active_support/duration/iso8601_parser'
|
@@ -140,8 +142,7 @@ module ActiveSupport
|
|
140
142
|
# If invalid string is provided, it will raise +ActiveSupport::Duration::ISO8601Parser::ParsingError+.
|
141
143
|
def self.parse(iso8601duration)
|
142
144
|
parts = ISO8601Parser.new(iso8601duration).parse!
|
143
|
-
|
144
|
-
new(time.advance(parts) - time, parts)
|
145
|
+
new(EPOCH.advance(parts) - EPOCH, parts)
|
145
146
|
end
|
146
147
|
|
147
148
|
# Build ISO 8601 Duration string for this duration.
|
@@ -19,6 +19,23 @@ module ActiveSupport
|
|
19
19
|
set_callback(:complete, *args, &block)
|
20
20
|
end
|
21
21
|
|
22
|
+
class RunHook < Struct.new(:hook) # :nodoc:
|
23
|
+
def before(target)
|
24
|
+
hook_state = target.send(:hook_state)
|
25
|
+
hook_state[hook] = hook.run
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class CompleteHook < Struct.new(:hook) # :nodoc:
|
30
|
+
def before(target)
|
31
|
+
hook_state = target.send(:hook_state)
|
32
|
+
if hook_state.key?(hook)
|
33
|
+
hook.complete hook_state[hook]
|
34
|
+
end
|
35
|
+
end
|
36
|
+
alias after before
|
37
|
+
end
|
38
|
+
|
22
39
|
# Register an object to be invoked during both the +run+ and
|
23
40
|
# +complete+ steps.
|
24
41
|
#
|
@@ -29,19 +46,11 @@ module ActiveSupport
|
|
29
46
|
# invoked in that situation.)
|
30
47
|
def self.register_hook(hook, outer: false)
|
31
48
|
if outer
|
32
|
-
|
33
|
-
|
49
|
+
to_run RunHook.new(hook), prepend: true
|
50
|
+
to_complete :after, CompleteHook.new(hook)
|
34
51
|
else
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
to_run(*run_args) do
|
39
|
-
hook_state[hook] = hook.run
|
40
|
-
end
|
41
|
-
to_complete(*complete_args) do
|
42
|
-
if hook_state.key?(hook)
|
43
|
-
hook.complete hook_state[hook]
|
44
|
-
end
|
52
|
+
to_run RunHook.new(hook)
|
53
|
+
to_complete CompleteHook.new(hook)
|
45
54
|
end
|
46
55
|
end
|
47
56
|
|
@@ -40,6 +40,12 @@ module ActiveSupport
|
|
40
40
|
# rgb = { black: '#000000', white: '#FFFFFF' }.with_indifferent_access
|
41
41
|
#
|
42
42
|
# which may be handy.
|
43
|
+
#
|
44
|
+
# To access this class outside of Rails, require the core extension with:
|
45
|
+
#
|
46
|
+
# require "active_support/core_ext/hash/indifferent_access"
|
47
|
+
#
|
48
|
+
# which will, in turn, require this file.
|
43
49
|
class HashWithIndifferentAccess < Hash
|
44
50
|
# Returns +true+ so that <tt>Array#extract_options!</tt> finds members of
|
45
51
|
# this class.
|
@@ -20,29 +20,37 @@ module ActiveSupport
|
|
20
20
|
# +activerecord/lib/active_record/base.rb+ is:
|
21
21
|
#
|
22
22
|
# ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Base)
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
23
|
+
module LazyLoadHooks
|
24
|
+
def self.extended(base) # :nodoc:
|
25
|
+
base.class_eval do
|
26
|
+
@load_hooks = Hash.new { |h,k| h[k] = [] }
|
27
|
+
@loaded = Hash.new { |h,k| h[k] = [] }
|
28
|
+
end
|
29
29
|
end
|
30
30
|
|
31
|
-
|
32
|
-
|
31
|
+
def on_load(name, options = {}, &block)
|
32
|
+
@loaded[name].each do |base|
|
33
|
+
execute_hook(base, options, block)
|
34
|
+
end
|
33
35
|
|
34
|
-
|
35
|
-
if options[:yield]
|
36
|
-
block.call(base)
|
37
|
-
else
|
38
|
-
base.instance_eval(&block)
|
36
|
+
@load_hooks[name] << [block, options]
|
39
37
|
end
|
40
|
-
end
|
41
38
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
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
|
+
def run_load_hooks(name, base = Object)
|
48
|
+
@loaded[name] << base
|
49
|
+
@load_hooks[name].each do |hook, options|
|
50
|
+
execute_hook(base, options, hook)
|
51
|
+
end
|
46
52
|
end
|
47
53
|
end
|
54
|
+
|
55
|
+
extend LazyLoadHooks
|
48
56
|
end
|
@@ -59,14 +59,14 @@ module ActiveSupport
|
|
59
59
|
define_method(:silence) do |level = Logger::ERROR, &block|
|
60
60
|
if logger.respond_to?(:silence)
|
61
61
|
logger.silence(level) do
|
62
|
-
if
|
62
|
+
if defined?(super)
|
63
63
|
super(level, &block)
|
64
64
|
else
|
65
65
|
block.call(self)
|
66
66
|
end
|
67
67
|
end
|
68
68
|
else
|
69
|
-
if
|
69
|
+
if defined?(super)
|
70
70
|
super(level, &block)
|
71
71
|
else
|
72
72
|
block.call(self)
|
@@ -18,6 +18,8 @@ module ActiveSupport
|
|
18
18
|
# encrypted_data = crypt.encrypt_and_sign('my secret data') # => "NlFBTTMwOUV5UlA1QlNEN2xkY2d6eThYWWh..."
|
19
19
|
# crypt.decrypt_and_verify(encrypted_data) # => "my secret data"
|
20
20
|
class MessageEncryptor
|
21
|
+
DEFAULT_CIPHER = "aes-256-cbc"
|
22
|
+
|
21
23
|
module NullSerializer #:nodoc:
|
22
24
|
def self.load(value)
|
23
25
|
value
|
@@ -64,6 +66,11 @@ module ActiveSupport
|
|
64
66
|
_decrypt(verifier.verify(value))
|
65
67
|
end
|
66
68
|
|
69
|
+
# Given a cipher, returns the key length of the cipher to help generate the key of desired size
|
70
|
+
def self.key_len(cipher = DEFAULT_CIPHER)
|
71
|
+
OpenSSL::Cipher.new(cipher).key_len
|
72
|
+
end
|
73
|
+
|
67
74
|
private
|
68
75
|
|
69
76
|
def _encrypt(value)
|
@@ -88,6 +88,8 @@ module ActiveSupport
|
|
88
88
|
if handler = handler_for_rescue(exception, object: object)
|
89
89
|
handler.call exception
|
90
90
|
exception
|
91
|
+
elsif exception
|
92
|
+
rescue_with_handler(exception.cause, object: object)
|
91
93
|
end
|
92
94
|
end
|
93
95
|
|
@@ -121,7 +123,7 @@ module ActiveSupport
|
|
121
123
|
end
|
122
124
|
end
|
123
125
|
|
124
|
-
handler
|
126
|
+
handler
|
125
127
|
end
|
126
128
|
end
|
127
129
|
|
@@ -48,13 +48,12 @@ module ActiveSupport
|
|
48
48
|
Thread.current[thread_key] ||= []
|
49
49
|
end
|
50
50
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
tags.collect { |tag| "[#{tag}] " }.join
|
56
|
-
end
|
51
|
+
def tags_text
|
52
|
+
tags = current_tags
|
53
|
+
if tags.any?
|
54
|
+
tags.collect { |tag| "[#{tag}] " }.join
|
57
55
|
end
|
56
|
+
end
|
58
57
|
end
|
59
58
|
|
60
59
|
def self.new(logger)
|
@@ -2,11 +2,8 @@ gem 'minitest'
|
|
2
2
|
|
3
3
|
require 'minitest'
|
4
4
|
|
5
|
-
if Minitest.respond_to?(:
|
6
|
-
|
7
|
-
Minitest.run_with_autorun = true
|
8
|
-
Minitest.autorun
|
9
|
-
end
|
10
|
-
else
|
11
|
-
Minitest.autorun
|
5
|
+
if Minitest.respond_to?(:run_via) && !Minitest.run_via[:rails]
|
6
|
+
Minitest.run_via[:ruby] = true
|
12
7
|
end
|
8
|
+
|
9
|
+
Minitest.autorun
|
@@ -280,6 +280,7 @@ module ActiveSupport
|
|
280
280
|
end
|
281
281
|
end
|
282
282
|
alias_method :since, :+
|
283
|
+
alias_method :in, :+
|
283
284
|
|
284
285
|
# Returns a new TimeWithZone object that represents the difference between
|
285
286
|
# the current object's time and the +other+ time.
|
@@ -481,7 +482,7 @@ module ActiveSupport
|
|
481
482
|
end
|
482
483
|
|
483
484
|
def duration_of_variable_length?(obj)
|
484
|
-
ActiveSupport::Duration === obj && obj.parts.any? {|p| [:years, :months, :days].include?(p[0]) }
|
485
|
+
ActiveSupport::Duration === obj && obj.parts.any? {|p| [:years, :months, :weeks, :days].include?(p[0]) }
|
485
486
|
end
|
486
487
|
|
487
488
|
def wrap_with_time_zone(time)
|
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.
|
4
|
+
version: 5.0.1.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: 2016-
|
11
|
+
date: 2016-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -331,15 +331,14 @@ 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:
|
336
|
+
version: 1.3.1
|
337
337
|
requirements: []
|
338
338
|
rubyforge_project:
|
339
|
-
rubygems_version: 2.
|
339
|
+
rubygems_version: 2.5.2
|
340
340
|
signing_key:
|
341
341
|
specification_version: 4
|
342
342
|
summary: A toolkit of support libraries and Ruby core extensions extracted from the
|
343
343
|
Rails framework.
|
344
344
|
test_files: []
|
345
|
-
has_rdoc:
|