activesupport 4.2.0 → 4.2.10

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 (65) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +280 -0
  3. data/lib/active_support/cache/mem_cache_store.rb +1 -1
  4. data/lib/active_support/cache.rb +3 -3
  5. data/lib/active_support/callbacks.rb +126 -82
  6. data/lib/active_support/concern.rb +1 -1
  7. data/lib/active_support/core_ext/big_decimal/yaml_conversions.rb +2 -0
  8. data/lib/active_support/core_ext/class/subclasses.rb +0 -2
  9. data/lib/active_support/core_ext/date/conversions.rb +6 -0
  10. data/lib/active_support/core_ext/date_and_time/calculations.rb +11 -0
  11. data/lib/active_support/core_ext/date_and_time/compatibility.rb +15 -0
  12. data/lib/active_support/core_ext/date_time/calculations.rb +23 -3
  13. data/lib/active_support/core_ext/date_time/compatibility.rb +15 -0
  14. data/lib/active_support/core_ext/date_time.rb +1 -0
  15. data/lib/active_support/core_ext/enumerable.rb +16 -0
  16. data/lib/active_support/core_ext/hash/compact.rb +19 -15
  17. data/lib/active_support/core_ext/hash/conversions.rb +1 -2
  18. data/lib/active_support/core_ext/hash/transform_values.rb +2 -2
  19. data/lib/active_support/core_ext/integer/time.rb +0 -15
  20. data/lib/active_support/core_ext/kernel/debugger.rb +1 -1
  21. data/lib/active_support/core_ext/kernel/reporting.rb +1 -0
  22. data/lib/active_support/core_ext/marshal.rb +8 -5
  23. data/lib/active_support/core_ext/module/delegation.rb +24 -12
  24. data/lib/active_support/core_ext/module/method_transplanting.rb +3 -1
  25. data/lib/active_support/core_ext/numeric/conversions.rb +11 -3
  26. data/lib/active_support/core_ext/numeric/time.rb +0 -15
  27. data/lib/active_support/core_ext/object/blank.rb +2 -2
  28. data/lib/active_support/core_ext/object/duplicable.rb +58 -32
  29. data/lib/active_support/core_ext/object/json.rb +2 -2
  30. data/lib/active_support/core_ext/object/try.rb +2 -2
  31. data/lib/active_support/core_ext/string/access.rb +1 -1
  32. data/lib/active_support/core_ext/string/conversions.rb +1 -1
  33. data/lib/active_support/core_ext/string/filters.rb +4 -3
  34. data/lib/active_support/core_ext/string/output_safety.rb +6 -2
  35. data/lib/active_support/core_ext/time/calculations.rb +18 -2
  36. data/lib/active_support/core_ext/time/compatibility.rb +14 -0
  37. data/lib/active_support/core_ext/time.rb +1 -0
  38. data/lib/active_support/deprecation/behaviors.rb +1 -1
  39. data/lib/active_support/duration.rb +25 -1
  40. data/lib/active_support/gem_version.rb +1 -1
  41. data/lib/active_support/hash_with_indifferent_access.rb +22 -3
  42. data/lib/active_support/inflector/methods.rb +1 -1
  43. data/lib/active_support/json/encoding.rb +5 -0
  44. data/lib/active_support/logger.rb +50 -0
  45. data/lib/active_support/logger_silence.rb +7 -4
  46. data/lib/active_support/logger_thread_safe_level.rb +32 -0
  47. data/lib/active_support/message_encryptor.rb +8 -1
  48. data/lib/active_support/message_verifier.rb +1 -1
  49. data/lib/active_support/multibyte/chars.rb +1 -1
  50. data/lib/active_support/notifications/fanout.rb +1 -1
  51. data/lib/active_support/number_helper/number_to_rounded_converter.rb +1 -1
  52. data/lib/active_support/per_thread_registry.rb +5 -3
  53. data/lib/active_support/security_utils.rb +7 -0
  54. data/lib/active_support/testing/time_helpers.rb +16 -13
  55. data/lib/active_support/time_with_zone.rb +29 -17
  56. data/lib/active_support/values/time_zone.rb +10 -5
  57. data/lib/active_support/xml_mini/jdom.rb +6 -5
  58. data/lib/active_support/xml_mini/libxml.rb +1 -3
  59. data/lib/active_support/xml_mini/libxmlsax.rb +1 -4
  60. data/lib/active_support/xml_mini/nokogiri.rb +1 -3
  61. data/lib/active_support/xml_mini/nokogirisax.rb +1 -3
  62. data/lib/active_support/xml_mini/rexml.rb +7 -8
  63. data/lib/active_support/xml_mini.rb +33 -15
  64. data/lib/active_support.rb +9 -0
  65. metadata +7 -23
@@ -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 },
@@ -78,6 +93,9 @@ module ActiveSupport
78
93
  )
79
94
  end
80
95
 
96
+ attr_accessor :depth
97
+ self.depth = 100
98
+
81
99
  delegate :parse, :to => :backend
82
100
 
83
101
  def backend
@@ -26,6 +26,7 @@ require "active_support/dependencies/autoload"
26
26
  require "active_support/version"
27
27
  require "active_support/logger"
28
28
  require "active_support/lazy_load_hooks"
29
+ require "active_support/core_ext/date_and_time/compatibility"
29
30
 
30
31
  module ActiveSupport
31
32
  extend ActiveSupport::Autoload
@@ -80,6 +81,14 @@ module ActiveSupport
80
81
  def self.test_order # :nodoc:
81
82
  @@test_order
82
83
  end
84
+
85
+ def self.to_time_preserves_timezone
86
+ DateAndTime::Compatibility.preserve_timezone
87
+ end
88
+
89
+ def self.to_time_preserves_timezone=(value)
90
+ DateAndTime::Compatibility.preserve_timezone = value
91
+ end
83
92
  end
84
93
 
85
94
  autoload :I18n, "active_support/i18n"
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.0
4
+ version: 4.2.10
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-12-20 00:00:00.000000000 Z
11
+ date: 2017-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
@@ -24,26 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.7'
27
- - !ruby/object:Gem::Dependency
28
- name: json
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.7'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 1.7.7
37
- type: :runtime
38
- prerelease: false
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - "~>"
42
- - !ruby/object:Gem::Version
43
- version: '1.7'
44
- - - ">="
45
- - !ruby/object:Gem::Version
46
- version: 1.7.7
47
27
  - !ruby/object:Gem::Dependency
48
28
  name: tzinfo
49
29
  requirement: !ruby/object:Gem::Requirement
@@ -142,10 +122,12 @@ 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
151
133
  - lib/active_support/core_ext/digest/uuid.rb
@@ -231,6 +213,7 @@ files:
231
213
  - lib/active_support/core_ext/time.rb
232
214
  - lib/active_support/core_ext/time/acts_like.rb
233
215
  - lib/active_support/core_ext/time/calculations.rb
216
+ - lib/active_support/core_ext/time/compatibility.rb
234
217
  - lib/active_support/core_ext/time/conversions.rb
235
218
  - lib/active_support/core_ext/time/marshal.rb
236
219
  - lib/active_support/core_ext/time/zones.rb
@@ -266,6 +249,7 @@ files:
266
249
  - lib/active_support/log_subscriber/test_helper.rb
267
250
  - lib/active_support/logger.rb
268
251
  - lib/active_support/logger_silence.rb
252
+ - lib/active_support/logger_thread_safe_level.rb
269
253
  - lib/active_support/message_encryptor.rb
270
254
  - lib/active_support/message_verifier.rb
271
255
  - lib/active_support/multibyte.rb
@@ -339,7 +323,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
339
323
  version: '0'
340
324
  requirements: []
341
325
  rubyforge_project:
342
- rubygems_version: 2.2.2
326
+ rubygems_version: 2.5.2
343
327
  signing_key:
344
328
  specification_version: 4
345
329
  summary: A toolkit of support libraries and Ruby core extensions extracted from the