activesupport 4.2.0.beta4 → 4.2.0.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 +13 -3
- data/lib/active_support/core_ext/hash/compact.rb +3 -3
- data/lib/active_support/core_ext/hash/except.rb +8 -2
- data/lib/active_support/core_ext/hash/slice.rb +8 -2
- data/lib/active_support/core_ext/string/filters.rb +19 -6
- data/lib/active_support/core_ext/string/output_safety.rb +5 -0
- data/lib/active_support/core_ext/time/zones.rb +1 -0
- data/lib/active_support/dependencies.rb +18 -13
- data/lib/active_support/dependencies/autoload.rb +1 -1
- data/lib/active_support/duration.rb +2 -1
- data/lib/active_support/gem_version.rb +1 -1
- data/lib/active_support/inflector/methods.rb +1 -1
- data/lib/active_support/message_verifier.rb +10 -2
- data/lib/active_support/multibyte/unicode.rb +1 -1
- data/lib/active_support/notifications.rb +1 -1
- data/lib/active_support/values/unicode_tables.dat +0 -0
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caee7cfa2a96aaf934d4cd377bb39757d4f16141
|
4
|
+
data.tar.gz: 7aff6e8441f05ce7683b27421df2d6980a4bcb14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c944001b96d6a512cdb58d02380291b27486daed225c4f6404c526c3f04028abfd9db75307e54fb0ad664b8da80aa1266df35ace84674eb728a9daf33dba05a6
|
7
|
+
data.tar.gz: 7f9c2f3acf99f17d6b21f13c1cb0531ede5dab6cc76ef8bc5018708444e4448941dc8e9b7816df6ce3da4513c21e070dce32d4dcabc3d65e532d673fb877ad23
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,19 @@
|
|
1
|
-
*
|
1
|
+
* The decorated `load` and `require` methods are now kept private.
|
2
|
+
|
3
|
+
Fixes #17553.
|
4
|
+
|
5
|
+
*Xavier Noria*
|
6
|
+
|
7
|
+
* `String#remove` and `String#remove!` accept multiple arguments.
|
8
|
+
|
9
|
+
*Pavel Pravosud*
|
10
|
+
|
11
|
+
* `TimeWithZone#strftime` now delegates every directive to `Time#strftime` except for '%Z',
|
2
12
|
it also now correctly handles escaped '%' characters placed just before time zone related directives.
|
3
13
|
|
4
14
|
*Pablo Herrero*
|
5
15
|
|
6
|
-
* Corrected Inflector#underscore handling of multiple successive acroynms.
|
16
|
+
* Corrected `Inflector#underscore` handling of multiple successive acroynms.
|
7
17
|
|
8
18
|
*James Le Cuirot*
|
9
19
|
|
@@ -156,7 +166,7 @@
|
|
156
166
|
|
157
167
|
* Fixed `ActiveSupport::Cache::FileStore` exploding with long paths.
|
158
168
|
|
159
|
-
*Adam Panzer
|
169
|
+
*Adam Panzer*, *Michael Grosser*
|
160
170
|
|
161
171
|
* Fixed `ActiveSupport::TimeWithZone#-` so precision is not unnecessarily lost
|
162
172
|
when working with objects with a nanosecond component.
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Hash
|
2
2
|
# Returns a hash with non +nil+ values.
|
3
|
-
#
|
3
|
+
#
|
4
4
|
# hash = { a: true, b: false, c: nil}
|
5
5
|
# hash.compact # => { a: true, b: false}
|
6
6
|
# hash # => { a: true, b: false, c: nil}
|
@@ -8,9 +8,9 @@ class Hash
|
|
8
8
|
def compact
|
9
9
|
self.select { |_, value| !value.nil? }
|
10
10
|
end
|
11
|
-
|
11
|
+
|
12
12
|
# Replaces current hash with non +nil+ values.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# hash = { a: true, b: false, c: nil}
|
15
15
|
# hash.compact! # => { a: true, b: false}
|
16
16
|
# hash # => { a: true, b: false}
|
@@ -1,13 +1,19 @@
|
|
1
1
|
class Hash
|
2
|
-
# Returns a hash that includes everything but the given keys.
|
3
|
-
#
|
2
|
+
# Returns a hash that includes everything but the given keys.
|
3
|
+
# hash = { a: true, b: false, c: nil}
|
4
|
+
# hash.except(:c) # => { a: true, b: false}
|
5
|
+
# hash # => { a: true, b: false, c: nil}
|
4
6
|
#
|
7
|
+
# This is useful for limiting a set of parameters to everything but a few known toggles:
|
5
8
|
# @person.update(params[:person].except(:admin))
|
6
9
|
def except(*keys)
|
7
10
|
dup.except!(*keys)
|
8
11
|
end
|
9
12
|
|
10
13
|
# Replaces the hash without the given keys.
|
14
|
+
# hash = { a: true, b: false, c: nil}
|
15
|
+
# hash.except!(:c) # => { a: true, b: false}
|
16
|
+
# hash # => { a: true, b: false }
|
11
17
|
def except!(*keys)
|
12
18
|
keys.each { |key| delete(key) }
|
13
19
|
self
|
@@ -1,6 +1,12 @@
|
|
1
1
|
class Hash
|
2
|
-
# Slice a hash to include only the given keys.
|
3
|
-
#
|
2
|
+
# Slice a hash to include only the given keys. Returns a hash containing
|
3
|
+
# the given keys.
|
4
|
+
#
|
5
|
+
# { a: 1, b: 2, c: 3, d: 4 }.slice(:a, :b)
|
6
|
+
# # => {:a=>1, :b=>2}
|
7
|
+
#
|
8
|
+
# This is useful for limiting an options hash to valid keys before
|
9
|
+
# passing to a method:
|
4
10
|
#
|
5
11
|
# def search(criteria = {})
|
6
12
|
# criteria.assert_valid_keys(:mass, :velocity, :time)
|
@@ -13,6 +13,9 @@ class String
|
|
13
13
|
end
|
14
14
|
|
15
15
|
# Performs a destructive squish. See String#squish.
|
16
|
+
# str = " foo bar \n \t boo"
|
17
|
+
# str.squish! # => "foo bar boo"
|
18
|
+
# str # => "foo bar boo"
|
16
19
|
def squish!
|
17
20
|
gsub!(/\A[[:space:]]+/, '')
|
18
21
|
gsub!(/[[:space:]]+\z/, '')
|
@@ -20,14 +23,24 @@ class String
|
|
20
23
|
self
|
21
24
|
end
|
22
25
|
|
23
|
-
# Returns a new string with all occurrences of the
|
24
|
-
|
25
|
-
|
26
|
+
# Returns a new string with all occurrences of the patterns removed.
|
27
|
+
# str = "foo bar test"
|
28
|
+
# str.remove(" test") # => "foo bar"
|
29
|
+
# str # => "foo bar test"
|
30
|
+
def remove(*patterns)
|
31
|
+
dup.remove!(*patterns)
|
26
32
|
end
|
27
33
|
|
28
|
-
# Alters the string by removing all occurrences of the
|
29
|
-
|
30
|
-
|
34
|
+
# Alters the string by removing all occurrences of the patterns.
|
35
|
+
# str = "foo bar test"
|
36
|
+
# str.remove!(" test") # => "foo bar"
|
37
|
+
# str # => "foo bar"
|
38
|
+
def remove!(*patterns)
|
39
|
+
patterns.each do |pattern|
|
40
|
+
gsub! pattern, ""
|
41
|
+
end
|
42
|
+
|
43
|
+
self
|
31
44
|
end
|
32
45
|
|
33
46
|
# Truncates a given +text+ after a given <tt>length</tt> if +text+ is longer than <tt>length</tt>:
|
@@ -247,6 +247,11 @@ module ActiveSupport #:nodoc:
|
|
247
247
|
end
|
248
248
|
|
249
249
|
class String
|
250
|
+
# Marks a string as trusted safe. It will be inserted into HTML with no
|
251
|
+
# additional escaping performed. It is your responsibilty to ensure that the
|
252
|
+
# string contains no malicious content. This method is equivalent to the
|
253
|
+
# `raw` helper in views. It is recommended that you use `sanitize` instead of
|
254
|
+
# this method. It should never be called on user input.
|
250
255
|
def html_safe
|
251
256
|
ActiveSupport::SafeBuffer.new(self)
|
252
257
|
end
|
@@ -205,7 +205,10 @@ module ActiveSupport #:nodoc:
|
|
205
205
|
# Object includes this module.
|
206
206
|
module Loadable #:nodoc:
|
207
207
|
def self.exclude_from(base)
|
208
|
-
base.class_eval
|
208
|
+
base.class_eval do
|
209
|
+
define_method(:load, Kernel.instance_method(:load))
|
210
|
+
private :load
|
211
|
+
end
|
209
212
|
end
|
210
213
|
|
211
214
|
def require_or_load(file_name)
|
@@ -241,18 +244,6 @@ module ActiveSupport #:nodoc:
|
|
241
244
|
raise
|
242
245
|
end
|
243
246
|
|
244
|
-
def load(file, wrap = false)
|
245
|
-
result = false
|
246
|
-
load_dependency(file) { result = super }
|
247
|
-
result
|
248
|
-
end
|
249
|
-
|
250
|
-
def require(file)
|
251
|
-
result = false
|
252
|
-
load_dependency(file) { result = super }
|
253
|
-
result
|
254
|
-
end
|
255
|
-
|
256
247
|
# Mark the given constant as unloadable. Unloadable constants are removed
|
257
248
|
# each time dependencies are cleared.
|
258
249
|
#
|
@@ -269,6 +260,20 @@ module ActiveSupport #:nodoc:
|
|
269
260
|
def unloadable(const_desc)
|
270
261
|
Dependencies.mark_for_unload const_desc
|
271
262
|
end
|
263
|
+
|
264
|
+
private
|
265
|
+
|
266
|
+
def load(file, wrap = false)
|
267
|
+
result = false
|
268
|
+
load_dependency(file) { result = super }
|
269
|
+
result
|
270
|
+
end
|
271
|
+
|
272
|
+
def require(file)
|
273
|
+
result = false
|
274
|
+
load_dependency(file) { result = super }
|
275
|
+
result
|
276
|
+
end
|
272
277
|
end
|
273
278
|
|
274
279
|
# Exception file-blaming.
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'active_support/proxy_object'
|
2
1
|
require 'active_support/core_ext/array/conversions'
|
3
2
|
require 'active_support/core_ext/object/acts_like'
|
4
3
|
|
@@ -103,6 +102,8 @@ module ActiveSupport
|
|
103
102
|
@value.respond_to?(method, include_private)
|
104
103
|
end
|
105
104
|
|
105
|
+
delegate :<=>, to: :value
|
106
|
+
|
106
107
|
protected
|
107
108
|
|
108
109
|
def sum(sign, time = ::Time.current) #:nodoc:
|
@@ -73,7 +73,7 @@ module ActiveSupport
|
|
73
73
|
string = string.sub(/^(?:#{inflections.acronym_regex}(?=\b|[A-Z_])|\w)/) { $&.downcase }
|
74
74
|
end
|
75
75
|
string.gsub!(/(?:_|(\/))([a-z\d]*)/i) { "#{$1}#{inflections.acronyms[$2] || $2.capitalize}" }
|
76
|
-
string.gsub!(
|
76
|
+
string.gsub!(/\//, '::')
|
77
77
|
string
|
78
78
|
end
|
79
79
|
|
@@ -40,7 +40,7 @@ module ActiveSupport
|
|
40
40
|
data, digest = signed_message.split("--")
|
41
41
|
if data.present? && digest.present? && ActiveSupport::SecurityUtils.secure_compare(digest, generate_digest(data))
|
42
42
|
begin
|
43
|
-
@serializer.load(
|
43
|
+
@serializer.load(decode(data))
|
44
44
|
rescue ArgumentError => argument_error
|
45
45
|
raise InvalidSignature if argument_error.message =~ %r{invalid base64}
|
46
46
|
raise
|
@@ -51,11 +51,19 @@ module ActiveSupport
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def generate(value)
|
54
|
-
data =
|
54
|
+
data = encode(@serializer.dump(value))
|
55
55
|
"#{data}--#{generate_digest(data)}"
|
56
56
|
end
|
57
57
|
|
58
58
|
private
|
59
|
+
def encode(data)
|
60
|
+
::Base64.strict_encode64(data)
|
61
|
+
end
|
62
|
+
|
63
|
+
def decode(data)
|
64
|
+
::Base64.strict_decode64(data)
|
65
|
+
end
|
66
|
+
|
59
67
|
def generate_digest(data)
|
60
68
|
require 'openssl' unless defined?(OpenSSL)
|
61
69
|
OpenSSL::HMAC.hexdigest(OpenSSL::Digest.const_get(@digest).new, @secret, data)
|
@@ -11,7 +11,7 @@ module ActiveSupport
|
|
11
11
|
NORMALIZATION_FORMS = [:c, :kc, :d, :kd]
|
12
12
|
|
13
13
|
# The Unicode version that is supported by the implementation
|
14
|
-
UNICODE_VERSION = '
|
14
|
+
UNICODE_VERSION = '7.0.0'
|
15
15
|
|
16
16
|
# The default normalization used for operations that require
|
17
17
|
# normalization. It can be set to any of the normalizations
|
@@ -16,7 +16,7 @@ module ActiveSupport
|
|
16
16
|
# render text: 'Foo'
|
17
17
|
# end
|
18
18
|
#
|
19
|
-
# That executes the block
|
19
|
+
# That first executes the block and then notifies all subscribers once done.
|
20
20
|
#
|
21
21
|
# In the example above +render+ is the name of the event, and the rest is called
|
22
22
|
# the _payload_. The payload is a mechanism that allows instrumenters to pass
|
Binary file
|
metadata
CHANGED
@@ -1,95 +1,95 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activesupport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.0.
|
4
|
+
version: 4.2.0.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: 2014-
|
11
|
+
date: 2014-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.7.0.beta1
|
20
|
-
- - <
|
20
|
+
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '0.8'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 0.7.0.beta1
|
30
|
-
- - <
|
30
|
+
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '0.8'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: json
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - ~>
|
37
|
+
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
39
|
version: '1.7'
|
40
|
-
- -
|
40
|
+
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: 1.7.7
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - ~>
|
47
|
+
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '1.7'
|
50
|
-
- -
|
50
|
+
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: 1.7.7
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: tzinfo
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- - ~>
|
57
|
+
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '1.1'
|
60
60
|
type: :runtime
|
61
61
|
prerelease: false
|
62
62
|
version_requirements: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- - ~>
|
64
|
+
- - "~>"
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: '1.1'
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: minitest
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- - ~>
|
71
|
+
- - "~>"
|
72
72
|
- !ruby/object:Gem::Version
|
73
73
|
version: '5.1'
|
74
74
|
type: :runtime
|
75
75
|
prerelease: false
|
76
76
|
version_requirements: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
|
-
- - ~>
|
78
|
+
- - "~>"
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '5.1'
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: thread_safe
|
83
83
|
requirement: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
|
-
- - ~>
|
85
|
+
- - "~>"
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '0.1'
|
88
88
|
type: :runtime
|
89
89
|
prerelease: false
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
|
-
- - ~>
|
92
|
+
- - "~>"
|
93
93
|
- !ruby/object:Gem::Version
|
94
94
|
version: '0.1'
|
95
95
|
description: A toolkit of support libraries and Ruby core extensions extracted from
|
@@ -323,23 +323,23 @@ licenses:
|
|
323
323
|
metadata: {}
|
324
324
|
post_install_message:
|
325
325
|
rdoc_options:
|
326
|
-
- --encoding
|
326
|
+
- "--encoding"
|
327
327
|
- UTF-8
|
328
328
|
require_paths:
|
329
329
|
- lib
|
330
330
|
required_ruby_version: !ruby/object:Gem::Requirement
|
331
331
|
requirements:
|
332
|
-
- -
|
332
|
+
- - ">="
|
333
333
|
- !ruby/object:Gem::Version
|
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
339
|
version: 1.3.1
|
340
340
|
requirements: []
|
341
341
|
rubyforge_project:
|
342
|
-
rubygems_version: 2.2.
|
342
|
+
rubygems_version: 2.2.2
|
343
343
|
signing_key:
|
344
344
|
specification_version: 4
|
345
345
|
summary: A toolkit of support libraries and Ruby core extensions extracted from the
|