activesupport 4.1.15 → 4.2.11.3

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.

Files changed (111) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +395 -574
  3. data/README.rdoc +7 -2
  4. data/lib/active_support.rb +19 -0
  5. data/lib/active_support/backtrace_cleaner.rb +4 -4
  6. data/lib/active_support/cache.rb +17 -19
  7. data/lib/active_support/cache/file_store.rb +5 -0
  8. data/lib/active_support/cache/mem_cache_store.rb +1 -1
  9. data/lib/active_support/cache/strategy/local_cache.rb +5 -4
  10. data/lib/active_support/cache/strategy/local_cache_middleware.rb +5 -0
  11. data/lib/active_support/callbacks.rb +41 -33
  12. data/lib/active_support/concern.rb +10 -2
  13. data/lib/active_support/core_ext/array/access.rb +9 -1
  14. data/lib/active_support/core_ext/array/grouping.rb +5 -0
  15. data/lib/active_support/core_ext/big_decimal/yaml_conversions.rb +2 -0
  16. data/lib/active_support/core_ext/class/delegating_attributes.rb +4 -0
  17. data/lib/active_support/core_ext/class/subclasses.rb +0 -2
  18. data/lib/active_support/core_ext/date/conversions.rb +6 -0
  19. data/lib/active_support/core_ext/date_and_time/calculations.rb +11 -0
  20. data/lib/active_support/core_ext/date_and_time/compatibility.rb +15 -0
  21. data/lib/active_support/core_ext/date_time.rb +1 -0
  22. data/lib/active_support/core_ext/date_time/calculations.rb +34 -4
  23. data/lib/active_support/core_ext/date_time/compatibility.rb +16 -0
  24. data/lib/active_support/core_ext/date_time/conversions.rb +2 -2
  25. data/lib/active_support/core_ext/digest/uuid.rb +51 -0
  26. data/lib/active_support/core_ext/enumerable.rb +16 -0
  27. data/lib/active_support/core_ext/file/atomic.rb +1 -1
  28. data/lib/active_support/core_ext/hash.rb +1 -0
  29. data/lib/active_support/core_ext/hash/compact.rb +20 -16
  30. data/lib/active_support/core_ext/hash/conversions.rb +3 -5
  31. data/lib/active_support/core_ext/hash/except.rb +8 -2
  32. data/lib/active_support/core_ext/hash/indifferent_access.rb +1 -1
  33. data/lib/active_support/core_ext/hash/keys.rb +10 -6
  34. data/lib/active_support/core_ext/hash/slice.rb +8 -2
  35. data/lib/active_support/core_ext/hash/transform_values.rb +23 -0
  36. data/lib/active_support/core_ext/integer/time.rb +0 -15
  37. data/lib/active_support/core_ext/kernel.rb +3 -2
  38. data/lib/active_support/core_ext/kernel/concern.rb +10 -0
  39. data/lib/active_support/core_ext/kernel/debugger.rb +1 -1
  40. data/lib/active_support/core_ext/kernel/reporting.rb +15 -0
  41. data/lib/active_support/core_ext/load_error.rb +4 -1
  42. data/lib/active_support/core_ext/marshal.rb +8 -5
  43. data/lib/active_support/core_ext/module/aliasing.rb +2 -2
  44. data/lib/active_support/core_ext/module/delegation.rb +34 -18
  45. data/lib/active_support/core_ext/module/method_transplanting.rb +3 -1
  46. data/lib/active_support/core_ext/numeric/conversions.rb +11 -3
  47. data/lib/active_support/core_ext/numeric/time.rb +1 -34
  48. data/lib/active_support/core_ext/object.rb +1 -0
  49. data/lib/active_support/core_ext/object/blank.rb +2 -2
  50. data/lib/active_support/core_ext/object/duplicable.rb +62 -33
  51. data/lib/active_support/core_ext/object/itself.rb +15 -0
  52. data/lib/active_support/core_ext/object/json.rb +2 -2
  53. data/lib/active_support/core_ext/object/to_query.rb +2 -1
  54. data/lib/active_support/core_ext/object/try.rb +35 -13
  55. data/lib/active_support/core_ext/object/with_options.rb +30 -3
  56. data/lib/active_support/core_ext/string/access.rb +5 -5
  57. data/lib/active_support/core_ext/string/conversions.rb +1 -1
  58. data/lib/active_support/core_ext/string/filters.rb +44 -6
  59. data/lib/active_support/core_ext/string/inflections.rb +4 -1
  60. data/lib/active_support/core_ext/string/output_safety.rb +33 -14
  61. data/lib/active_support/core_ext/thread.rb +7 -0
  62. data/lib/active_support/core_ext/time.rb +1 -0
  63. data/lib/active_support/core_ext/time/calculations.rb +31 -7
  64. data/lib/active_support/core_ext/time/compatibility.rb +14 -0
  65. data/lib/active_support/core_ext/time/conversions.rb +1 -1
  66. data/lib/active_support/dependencies.rb +32 -18
  67. data/lib/active_support/dependencies/autoload.rb +1 -1
  68. data/lib/active_support/deprecation.rb +1 -1
  69. data/lib/active_support/deprecation/behaviors.rb +1 -1
  70. data/lib/active_support/duration.rb +47 -5
  71. data/lib/active_support/gem_version.rb +4 -4
  72. data/lib/active_support/hash_with_indifferent_access.rb +35 -7
  73. data/lib/active_support/i18n_railtie.rb +1 -7
  74. data/lib/active_support/inflector/inflections.rb +2 -2
  75. data/lib/active_support/inflector/methods.rb +43 -19
  76. data/lib/active_support/json/decoding.rb +1 -1
  77. data/lib/active_support/json/encoding.rb +3 -2
  78. data/lib/active_support/logger.rb +36 -0
  79. data/lib/active_support/logger_silence.rb +4 -22
  80. data/lib/active_support/logger_thread_safe_level.rb +32 -0
  81. data/lib/active_support/message_encryptor.rb +10 -2
  82. data/lib/active_support/message_verifier.rb +11 -12
  83. data/lib/active_support/multibyte/chars.rb +1 -1
  84. data/lib/active_support/multibyte/unicode.rb +5 -4
  85. data/lib/active_support/notifications.rb +8 -3
  86. data/lib/active_support/notifications/fanout.rb +12 -7
  87. data/lib/active_support/number_helper.rb +12 -13
  88. data/lib/active_support/number_helper/number_to_currency_converter.rb +1 -1
  89. data/lib/active_support/number_helper/number_to_percentage_converter.rb +1 -1
  90. data/lib/active_support/number_helper/number_to_rounded_converter.rb +1 -1
  91. data/lib/active_support/per_thread_registry.rb +5 -3
  92. data/lib/active_support/test_case.rb +46 -12
  93. data/lib/active_support/testing/assertions.rb +1 -1
  94. data/lib/active_support/testing/constant_lookup.rb +1 -5
  95. data/lib/active_support/testing/declarative.rb +1 -25
  96. data/lib/active_support/testing/isolation.rb +16 -6
  97. data/lib/active_support/testing/tagged_logging.rb +1 -1
  98. data/lib/active_support/testing/time_helpers.rb +23 -16
  99. data/lib/active_support/time.rb +0 -2
  100. data/lib/active_support/time_with_zone.rb +48 -29
  101. data/lib/active_support/values/time_zone.rb +81 -75
  102. data/lib/active_support/values/unicode_tables.dat +0 -0
  103. data/lib/active_support/xml_mini.rb +30 -15
  104. data/lib/active_support/xml_mini/libxml.rb +1 -3
  105. data/lib/active_support/xml_mini/libxmlsax.rb +1 -4
  106. data/lib/active_support/xml_mini/nokogiri.rb +1 -3
  107. data/lib/active_support/xml_mini/nokogirisax.rb +1 -3
  108. data/lib/active_support/xml_mini/rexml.rb +1 -3
  109. metadata +21 -36
  110. data/lib/active_support/core_ext/object/to_json.rb +0 -5
  111. data/lib/active_support/file_watcher.rb +0 -36
@@ -32,20 +32,25 @@ module ActiveSupport
32
32
  "binary" => "base64"
33
33
  } unless defined?(DEFAULT_ENCODINGS)
34
34
 
35
- TYPE_NAMES = {
36
- "Symbol" => "symbol",
37
- "Fixnum" => "integer",
38
- "Bignum" => "integer",
39
- "BigDecimal" => "decimal",
40
- "Float" => "float",
41
- "TrueClass" => "boolean",
42
- "FalseClass" => "boolean",
43
- "Date" => "date",
44
- "DateTime" => "dateTime",
45
- "Time" => "dateTime",
46
- "Array" => "array",
47
- "Hash" => "hash"
48
- } unless defined?(TYPE_NAMES)
35
+ unless defined?(TYPE_NAMES)
36
+ TYPE_NAMES = {
37
+ "Symbol" => "symbol",
38
+ "Integer" => "integer",
39
+ "BigDecimal" => "decimal",
40
+ "Float" => "float",
41
+ "TrueClass" => "boolean",
42
+ "FalseClass" => "boolean",
43
+ "Date" => "date",
44
+ "DateTime" => "dateTime",
45
+ "Time" => "dateTime",
46
+ "Array" => "array",
47
+ "Hash" => "hash"
48
+ }
49
+
50
+ # No need to map these on Ruby 2.4+
51
+ TYPE_NAMES["Fixnum"] = "integer" unless 0.class == Integer
52
+ TYPE_NAMES["Bignum"] = "integer" unless 0.class == Integer
53
+ end
49
54
 
50
55
  FORMATTING = {
51
56
  "symbol" => Proc.new { |symbol| symbol.to_s },
@@ -63,7 +68,17 @@ module ActiveSupport
63
68
  "datetime" => Proc.new { |time| Time.xmlschema(time).utc rescue ::DateTime.parse(time).utc },
64
69
  "integer" => Proc.new { |integer| integer.to_i },
65
70
  "float" => Proc.new { |float| float.to_f },
66
- "decimal" => Proc.new { |number| BigDecimal(number) },
71
+ "decimal" => Proc.new do |number|
72
+ if String === number
73
+ begin
74
+ BigDecimal(number)
75
+ rescue ArgumentError
76
+ BigDecimal('0')
77
+ end
78
+ else
79
+ BigDecimal(number)
80
+ end
81
+ end,
67
82
  "boolean" => Proc.new { |boolean| %w(1 true).include?(boolean.to_s.strip) },
68
83
  "string" => Proc.new { |string| string.to_s },
69
84
  "yaml" => Proc.new { |yaml| YAML::load(yaml) rescue yaml },
@@ -14,11 +14,9 @@ module ActiveSupport
14
14
  data = StringIO.new(data || '')
15
15
  end
16
16
 
17
- char = data.getc
18
- if char.nil?
17
+ if data.eof?
19
18
  {}
20
19
  else
21
- data.ungetc(char)
22
20
  LibXML::XML::Parser.io(data).parse.to_hash
23
21
  end
24
22
  end
@@ -66,12 +66,9 @@ module ActiveSupport
66
66
  data = StringIO.new(data || '')
67
67
  end
68
68
 
69
- char = data.getc
70
- if char.nil?
69
+ if data.eof?
71
70
  {}
72
71
  else
73
- data.ungetc(char)
74
-
75
72
  LibXML::XML::Error.set_handler(&LibXML::XML::Error::QUIET_HANDLER)
76
73
  parser = LibXML::XML::SaxParser.io(data)
77
74
  document = self.document_class.new
@@ -19,11 +19,9 @@ module ActiveSupport
19
19
  data = StringIO.new(data || '')
20
20
  end
21
21
 
22
- char = data.getc
23
- if char.nil?
22
+ if data.eof?
24
23
  {}
25
24
  else
26
- data.ungetc(char)
27
25
  doc = Nokogiri::XML(data)
28
26
  raise doc.errors.first if doc.errors.length > 0
29
27
  doc.to_hash
@@ -72,11 +72,9 @@ module ActiveSupport
72
72
  data = StringIO.new(data || '')
73
73
  end
74
74
 
75
- char = data.getc
76
- if char.nil?
75
+ if data.eof?
77
76
  {}
78
77
  else
79
- data.ungetc(char)
80
78
  document = self.document_class.new
81
79
  parser = Nokogiri::XML::SAX::Parser.new(document)
82
80
  parser.parse(data)
@@ -20,11 +20,9 @@ module ActiveSupport
20
20
  data = StringIO.new(data || '')
21
21
  end
22
22
 
23
- char = data.getc
24
- if char.nil?
23
+ if data.eof?
25
24
  {}
26
25
  else
27
- data.ungetc(char)
28
26
  silence_warnings { require 'rexml/document' } unless defined?(REXML::Document)
29
27
  doc = REXML::Document.new(data)
30
28
 
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.1.15
4
+ version: 4.2.11.3
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-03-07 00:00:00.000000000 Z
11
+ date: 2020-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -16,40 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.6'
20
- - - ">="
21
- - !ruby/object:Gem::Version
22
- version: 0.6.9
19
+ version: '0.7'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '0.6'
30
- - - ">="
31
- - !ruby/object:Gem::Version
32
- version: 0.6.9
33
- - !ruby/object:Gem::Dependency
34
- name: json
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '1.7'
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: 1.7.7
43
- type: :runtime
44
- prerelease: false
45
- version_requirements: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '1.7'
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 1.7.7
26
+ version: '0.7'
53
27
  - !ruby/object:Gem::Dependency
54
28
  name: tzinfo
55
29
  requirement: !ruby/object:Gem::Requirement
@@ -84,14 +58,20 @@ dependencies:
84
58
  requirements:
85
59
  - - "~>"
86
60
  - !ruby/object:Gem::Version
87
- version: '0.1'
61
+ version: '0.3'
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 0.3.4
88
65
  type: :runtime
89
66
  prerelease: false
90
67
  version_requirements: !ruby/object:Gem::Requirement
91
68
  requirements:
92
69
  - - "~>"
93
70
  - !ruby/object:Gem::Version
94
- version: '0.1'
71
+ version: '0.3'
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: 0.3.4
95
75
  description: A toolkit of support libraries and Ruby core extensions extracted from
96
76
  the Rails framework. Rich support for multibyte strings, internationalization, time
97
77
  zones, and testing.
@@ -142,12 +122,15 @@ files:
142
122
  - lib/active_support/core_ext/date/conversions.rb
143
123
  - lib/active_support/core_ext/date/zones.rb
144
124
  - lib/active_support/core_ext/date_and_time/calculations.rb
125
+ - lib/active_support/core_ext/date_and_time/compatibility.rb
145
126
  - lib/active_support/core_ext/date_and_time/zones.rb
146
127
  - lib/active_support/core_ext/date_time.rb
147
128
  - lib/active_support/core_ext/date_time/acts_like.rb
148
129
  - lib/active_support/core_ext/date_time/calculations.rb
130
+ - lib/active_support/core_ext/date_time/compatibility.rb
149
131
  - lib/active_support/core_ext/date_time/conversions.rb
150
132
  - lib/active_support/core_ext/date_time/zones.rb
133
+ - lib/active_support/core_ext/digest/uuid.rb
151
134
  - lib/active_support/core_ext/enumerable.rb
152
135
  - lib/active_support/core_ext/file.rb
153
136
  - lib/active_support/core_ext/file/atomic.rb
@@ -160,12 +143,14 @@ files:
160
143
  - lib/active_support/core_ext/hash/keys.rb
161
144
  - lib/active_support/core_ext/hash/reverse_merge.rb
162
145
  - lib/active_support/core_ext/hash/slice.rb
146
+ - lib/active_support/core_ext/hash/transform_values.rb
163
147
  - lib/active_support/core_ext/integer.rb
164
148
  - lib/active_support/core_ext/integer/inflections.rb
165
149
  - lib/active_support/core_ext/integer/multiple.rb
166
150
  - lib/active_support/core_ext/integer/time.rb
167
151
  - lib/active_support/core_ext/kernel.rb
168
152
  - lib/active_support/core_ext/kernel/agnostics.rb
153
+ - lib/active_support/core_ext/kernel/concern.rb
169
154
  - lib/active_support/core_ext/kernel/debugger.rb
170
155
  - lib/active_support/core_ext/kernel/reporting.rb
171
156
  - lib/active_support/core_ext/kernel/singleton_class.rb
@@ -197,8 +182,8 @@ files:
197
182
  - lib/active_support/core_ext/object/duplicable.rb
198
183
  - lib/active_support/core_ext/object/inclusion.rb
199
184
  - lib/active_support/core_ext/object/instance_variables.rb
185
+ - lib/active_support/core_ext/object/itself.rb
200
186
  - lib/active_support/core_ext/object/json.rb
201
- - lib/active_support/core_ext/object/to_json.rb
202
187
  - lib/active_support/core_ext/object/to_param.rb
203
188
  - lib/active_support/core_ext/object/to_query.rb
204
189
  - lib/active_support/core_ext/object/try.rb
@@ -228,6 +213,7 @@ files:
228
213
  - lib/active_support/core_ext/time.rb
229
214
  - lib/active_support/core_ext/time/acts_like.rb
230
215
  - lib/active_support/core_ext/time/calculations.rb
216
+ - lib/active_support/core_ext/time/compatibility.rb
231
217
  - lib/active_support/core_ext/time/conversions.rb
232
218
  - lib/active_support/core_ext/time/marshal.rb
233
219
  - lib/active_support/core_ext/time/zones.rb
@@ -243,7 +229,6 @@ files:
243
229
  - lib/active_support/descendants_tracker.rb
244
230
  - lib/active_support/duration.rb
245
231
  - lib/active_support/file_update_checker.rb
246
- - lib/active_support/file_watcher.rb
247
232
  - lib/active_support/gem_version.rb
248
233
  - lib/active_support/gzip.rb
249
234
  - lib/active_support/hash_with_indifferent_access.rb
@@ -264,6 +249,7 @@ files:
264
249
  - lib/active_support/log_subscriber/test_helper.rb
265
250
  - lib/active_support/logger.rb
266
251
  - lib/active_support/logger_silence.rb
252
+ - lib/active_support/logger_thread_safe_level.rb
267
253
  - lib/active_support/message_encryptor.rb
268
254
  - lib/active_support/message_verifier.rb
269
255
  - lib/active_support/multibyte.rb
@@ -336,8 +322,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
336
322
  - !ruby/object:Gem::Version
337
323
  version: '0'
338
324
  requirements: []
339
- rubyforge_project:
340
- rubygems_version: 2.5.1
325
+ rubygems_version: 3.0.3
341
326
  signing_key:
342
327
  specification_version: 4
343
328
  summary: A toolkit of support libraries and Ruby core extensions extracted from the
@@ -1,5 +0,0 @@
1
- ActiveSupport::Deprecation.warn 'You have required `active_support/core_ext/object/to_json`. ' \
2
- 'This file will be removed in Rails 4.2. You should require `active_support/core_ext/object/json` ' \
3
- 'instead.'
4
-
5
- require 'active_support/core_ext/object/json'
@@ -1,36 +0,0 @@
1
- module ActiveSupport
2
- class FileWatcher
3
- class Backend
4
- def initialize(path, watcher)
5
- @watcher = watcher
6
- @path = path
7
- end
8
-
9
- def trigger(files)
10
- @watcher.trigger(files)
11
- end
12
- end
13
-
14
- def initialize
15
- @regex_matchers = {}
16
- end
17
-
18
- def watch(pattern, &block)
19
- @regex_matchers[pattern] = block
20
- end
21
-
22
- def trigger(files)
23
- trigger_files = Hash.new { |h,k| h[k] = Hash.new { |h2,k2| h2[k2] = [] } }
24
-
25
- files.each do |file, state|
26
- @regex_matchers.each do |pattern, block|
27
- trigger_files[block][state] << file if pattern === file
28
- end
29
- end
30
-
31
- trigger_files.each do |block, payload|
32
- block.call payload
33
- end
34
- end
35
- end
36
- end