activesupport 4.2.11.1 → 6.0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of activesupport might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +399 -411
- data/MIT-LICENSE +2 -2
- data/README.rdoc +7 -7
- data/lib/active_support/actionable_error.rb +48 -0
- data/lib/active_support/all.rb +5 -3
- data/lib/active_support/array_inquirer.rb +48 -0
- data/lib/active_support/backtrace_cleaner.rb +34 -6
- data/lib/active_support/benchmarkable.rb +6 -4
- data/lib/active_support/builder.rb +3 -1
- data/lib/active_support/cache/file_store.rb +58 -53
- data/lib/active_support/cache/mem_cache_store.rb +95 -91
- data/lib/active_support/cache/memory_store.rb +39 -36
- data/lib/active_support/cache/null_store.rb +11 -7
- data/lib/active_support/cache/redis_cache_store.rb +493 -0
- data/lib/active_support/cache/strategy/local_cache.rb +75 -42
- data/lib/active_support/cache/strategy/local_cache_middleware.rb +10 -9
- data/lib/active_support/cache.rb +331 -217
- data/lib/active_support/callbacks.rb +650 -592
- data/lib/active_support/concern.rb +35 -6
- data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +35 -0
- data/lib/active_support/concurrency/share_lock.rb +226 -0
- data/lib/active_support/configurable.rb +13 -14
- data/lib/active_support/core_ext/array/access.rb +41 -1
- data/lib/active_support/core_ext/array/conversions.rb +24 -20
- data/lib/active_support/core_ext/array/extract.rb +21 -0
- data/lib/active_support/core_ext/array/extract_options.rb +2 -0
- data/lib/active_support/core_ext/array/grouping.rb +11 -18
- data/lib/active_support/core_ext/array/inquiry.rb +19 -0
- data/lib/active_support/core_ext/array/prepend_and_append.rb +4 -6
- data/lib/active_support/core_ext/array/wrap.rb +7 -4
- data/lib/active_support/core_ext/array.rb +9 -6
- data/lib/active_support/core_ext/benchmark.rb +3 -1
- data/lib/active_support/core_ext/big_decimal/conversions.rb +10 -12
- data/lib/active_support/core_ext/big_decimal.rb +3 -1
- data/lib/active_support/core_ext/class/attribute.rb +45 -31
- data/lib/active_support/core_ext/class/attribute_accessors.rb +3 -1
- data/lib/active_support/core_ext/class/subclasses.rb +20 -6
- data/lib/active_support/core_ext/class.rb +4 -3
- data/lib/active_support/core_ext/date/acts_like.rb +3 -1
- data/lib/active_support/core_ext/date/blank.rb +14 -0
- data/lib/active_support/core_ext/date/calculations.rb +17 -14
- data/lib/active_support/core_ext/date/conversions.rb +25 -23
- data/lib/active_support/core_ext/date/zones.rb +4 -2
- data/lib/active_support/core_ext/date.rb +6 -4
- data/lib/active_support/core_ext/date_and_time/calculations.rb +154 -65
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +4 -3
- data/lib/active_support/core_ext/date_and_time/zones.rb +12 -13
- data/lib/active_support/core_ext/date_time/acts_like.rb +4 -2
- data/lib/active_support/core_ext/date_time/blank.rb +14 -0
- data/lib/active_support/core_ext/date_time/calculations.rb +37 -19
- data/lib/active_support/core_ext/date_time/compatibility.rb +8 -6
- data/lib/active_support/core_ext/date_time/conversions.rb +16 -13
- data/lib/active_support/core_ext/date_time.rb +7 -5
- data/lib/active_support/core_ext/digest/uuid.rb +7 -5
- data/lib/active_support/core_ext/digest.rb +3 -0
- data/lib/active_support/core_ext/enumerable.rb +114 -22
- data/lib/active_support/core_ext/file/atomic.rb +38 -31
- data/lib/active_support/core_ext/file.rb +3 -1
- data/lib/active_support/core_ext/hash/compact.rb +4 -23
- data/lib/active_support/core_ext/hash/conversions.rb +62 -41
- data/lib/active_support/core_ext/hash/deep_merge.rb +9 -13
- data/lib/active_support/core_ext/hash/deep_transform_values.rb +46 -0
- data/lib/active_support/core_ext/hash/except.rb +12 -9
- data/lib/active_support/core_ext/hash/indifferent_access.rb +4 -3
- data/lib/active_support/core_ext/hash/keys.rb +19 -42
- data/lib/active_support/core_ext/hash/reverse_merge.rb +5 -2
- data/lib/active_support/core_ext/hash/slice.rb +5 -27
- data/lib/active_support/core_ext/hash/transform_values.rb +4 -22
- data/lib/active_support/core_ext/hash.rb +10 -9
- data/lib/active_support/core_ext/integer/inflections.rb +3 -1
- data/lib/active_support/core_ext/integer/multiple.rb +3 -1
- data/lib/active_support/core_ext/integer/time.rb +11 -18
- data/lib/active_support/core_ext/integer.rb +5 -3
- data/lib/active_support/core_ext/kernel/concern.rb +5 -1
- data/lib/active_support/core_ext/kernel/reporting.rb +4 -84
- data/lib/active_support/core_ext/kernel/singleton_class.rb +2 -0
- data/lib/active_support/core_ext/kernel.rb +5 -5
- data/lib/active_support/core_ext/load_error.rb +3 -22
- data/lib/active_support/core_ext/marshal.rb +8 -8
- data/lib/active_support/core_ext/module/aliasing.rb +6 -44
- data/lib/active_support/core_ext/module/anonymous.rb +12 -1
- data/lib/active_support/core_ext/module/attr_internal.rb +8 -9
- data/lib/active_support/core_ext/module/attribute_accessors.rb +46 -46
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +144 -0
- data/lib/active_support/core_ext/module/concerning.rb +11 -12
- data/lib/active_support/core_ext/module/delegation.rb +133 -30
- data/lib/active_support/core_ext/module/deprecation.rb +4 -2
- data/lib/active_support/core_ext/module/introspection.rb +44 -19
- data/lib/active_support/core_ext/module/reachable.rb +5 -7
- data/lib/active_support/core_ext/module/redefine_method.rb +40 -0
- data/lib/active_support/core_ext/module/remove_method.rb +8 -3
- data/lib/active_support/core_ext/module.rb +13 -11
- data/lib/active_support/core_ext/name_error.rb +22 -2
- data/lib/active_support/core_ext/numeric/bytes.rb +22 -0
- data/lib/active_support/core_ext/numeric/conversions.rb +129 -136
- data/lib/active_support/core_ext/numeric/inquiry.rb +5 -0
- data/lib/active_support/core_ext/numeric/time.rb +35 -23
- data/lib/active_support/core_ext/numeric.rb +5 -3
- data/lib/active_support/core_ext/object/acts_like.rb +12 -1
- data/lib/active_support/core_ext/object/blank.rb +27 -3
- data/lib/active_support/core_ext/object/conversions.rb +6 -4
- data/lib/active_support/core_ext/object/deep_dup.rb +13 -4
- data/lib/active_support/core_ext/object/duplicable.rb +13 -93
- data/lib/active_support/core_ext/object/inclusion.rb +5 -3
- data/lib/active_support/core_ext/object/instance_variables.rb +3 -1
- data/lib/active_support/core_ext/object/json.rb +51 -20
- data/lib/active_support/core_ext/object/to_param.rb +3 -1
- data/lib/active_support/core_ext/object/to_query.rb +10 -5
- data/lib/active_support/core_ext/object/try.rb +81 -23
- data/lib/active_support/core_ext/object/with_options.rb +16 -3
- data/lib/active_support/core_ext/object.rb +14 -13
- data/lib/active_support/core_ext/range/compare_range.rb +76 -0
- data/lib/active_support/core_ext/range/conversions.rb +37 -15
- data/lib/active_support/core_ext/range/each.rb +18 -17
- data/lib/active_support/core_ext/range/include_range.rb +7 -21
- data/lib/active_support/core_ext/range/include_time_with_zone.rb +23 -0
- data/lib/active_support/core_ext/range/overlaps.rb +2 -0
- data/lib/active_support/core_ext/range.rb +7 -4
- data/lib/active_support/core_ext/regexp.rb +2 -0
- data/lib/active_support/core_ext/securerandom.rb +45 -0
- data/lib/active_support/core_ext/string/access.rb +16 -6
- data/lib/active_support/core_ext/string/behavior.rb +3 -1
- data/lib/active_support/core_ext/string/conversions.rb +7 -4
- data/lib/active_support/core_ext/string/exclude.rb +2 -0
- data/lib/active_support/core_ext/string/filters.rb +48 -6
- data/lib/active_support/core_ext/string/indent.rb +6 -4
- data/lib/active_support/core_ext/string/inflections.rb +66 -24
- data/lib/active_support/core_ext/string/inquiry.rb +3 -1
- data/lib/active_support/core_ext/string/multibyte.rb +16 -7
- data/lib/active_support/core_ext/string/output_safety.rb +93 -40
- data/lib/active_support/core_ext/string/starts_ends_with.rb +2 -0
- data/lib/active_support/core_ext/string/strip.rb +6 -5
- data/lib/active_support/core_ext/string/zones.rb +4 -2
- data/lib/active_support/core_ext/string.rb +15 -13
- data/lib/active_support/core_ext/time/acts_like.rb +3 -1
- data/lib/active_support/core_ext/time/calculations.rb +115 -52
- data/lib/active_support/core_ext/time/compatibility.rb +4 -2
- data/lib/active_support/core_ext/time/conversions.rb +20 -13
- data/lib/active_support/core_ext/time/zones.rb +41 -7
- data/lib/active_support/core_ext/time.rb +7 -6
- data/lib/active_support/core_ext/uri.rb +6 -7
- data/lib/active_support/core_ext.rb +3 -1
- data/lib/active_support/current_attributes.rb +203 -0
- data/lib/active_support/dependencies/autoload.rb +2 -0
- data/lib/active_support/dependencies/interlock.rb +57 -0
- data/lib/active_support/dependencies/zeitwerk_integration.rb +117 -0
- data/lib/active_support/dependencies.rb +208 -166
- data/lib/active_support/deprecation/behaviors.rb +44 -11
- data/lib/active_support/deprecation/constant_accessor.rb +52 -0
- data/lib/active_support/deprecation/instance_delegator.rb +17 -2
- data/lib/active_support/deprecation/method_wrappers.rb +61 -21
- data/lib/active_support/deprecation/proxy_wrappers.rb +81 -30
- data/lib/active_support/deprecation/reporting.rb +32 -12
- data/lib/active_support/deprecation.rb +12 -9
- data/lib/active_support/descendants_tracker.rb +57 -9
- data/lib/active_support/digest.rb +20 -0
- data/lib/active_support/duration/iso8601_parser.rb +123 -0
- data/lib/active_support/duration/iso8601_serializer.rb +53 -0
- data/lib/active_support/duration.rb +315 -40
- data/lib/active_support/encrypted_configuration.rb +45 -0
- data/lib/active_support/encrypted_file.rb +100 -0
- data/lib/active_support/evented_file_update_checker.rb +234 -0
- data/lib/active_support/execution_wrapper.rb +129 -0
- data/lib/active_support/executor.rb +8 -0
- data/lib/active_support/file_update_checker.rb +62 -37
- data/lib/active_support/gem_version.rb +6 -4
- data/lib/active_support/gzip.rb +7 -5
- data/lib/active_support/hash_with_indifferent_access.rb +129 -30
- data/lib/active_support/i18n.rb +9 -6
- data/lib/active_support/i18n_railtie.rb +50 -14
- data/lib/active_support/inflections.rb +13 -11
- data/lib/active_support/inflector/inflections.rb +58 -13
- data/lib/active_support/inflector/methods.rb +159 -145
- data/lib/active_support/inflector/transliterate.rb +84 -34
- data/lib/active_support/inflector.rb +7 -5
- data/lib/active_support/json/decoding.rb +32 -30
- data/lib/active_support/json/encoding.rb +17 -60
- data/lib/active_support/json.rb +4 -2
- data/lib/active_support/key_generator.rb +11 -43
- data/lib/active_support/lazy_load_hooks.rb +53 -20
- data/lib/active_support/locale/en.rb +33 -0
- data/lib/active_support/locale/en.yml +2 -0
- data/lib/active_support/log_subscriber/test_helper.rb +14 -12
- data/lib/active_support/log_subscriber.rb +44 -19
- data/lib/active_support/logger.rb +9 -23
- data/lib/active_support/logger_silence.rb +32 -14
- data/lib/active_support/logger_thread_safe_level.rb +32 -8
- data/lib/active_support/message_encryptor.rb +166 -53
- data/lib/active_support/message_verifier.rb +149 -16
- data/lib/active_support/messages/metadata.rb +72 -0
- data/lib/active_support/messages/rotation_configuration.rb +22 -0
- data/lib/active_support/messages/rotator.rb +56 -0
- data/lib/active_support/multibyte/chars.rb +56 -63
- data/lib/active_support/multibyte/unicode.rb +56 -290
- data/lib/active_support/multibyte.rb +4 -2
- data/lib/active_support/notifications/fanout.rb +109 -22
- data/lib/active_support/notifications/instrumenter.rb +107 -16
- data/lib/active_support/notifications.rb +51 -10
- data/lib/active_support/number_helper/number_converter.rb +16 -15
- data/lib/active_support/number_helper/number_to_currency_converter.rb +14 -15
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +11 -4
- data/lib/active_support/number_helper/number_to_human_converter.rb +13 -10
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +11 -9
- data/lib/active_support/number_helper/number_to_percentage_converter.rb +5 -1
- data/lib/active_support/number_helper/number_to_phone_converter.rb +15 -5
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +25 -57
- data/lib/active_support/number_helper/rounding_helper.rb +66 -0
- data/lib/active_support/number_helper.rb +105 -68
- data/lib/active_support/option_merger.rb +24 -4
- data/lib/active_support/ordered_hash.rb +7 -5
- data/lib/active_support/ordered_options.rb +27 -5
- data/lib/active_support/parameter_filter.rb +128 -0
- data/lib/active_support/per_thread_registry.rb +9 -4
- data/lib/active_support/proxy_object.rb +2 -0
- data/lib/active_support/rails.rb +10 -8
- data/lib/active_support/railtie.rb +43 -9
- data/lib/active_support/reloader.rb +130 -0
- data/lib/active_support/rescuable.rb +108 -53
- data/lib/active_support/security_utils.rb +15 -11
- data/lib/active_support/string_inquirer.rb +11 -4
- data/lib/active_support/subscriber.rb +74 -30
- data/lib/active_support/tagged_logging.rb +25 -13
- data/lib/active_support/test_case.rb +107 -44
- data/lib/active_support/testing/assertions.rb +151 -20
- data/lib/active_support/testing/autorun.rb +4 -2
- data/lib/active_support/testing/constant_lookup.rb +2 -1
- data/lib/active_support/testing/declarative.rb +3 -1
- data/lib/active_support/testing/deprecation.rb +13 -10
- data/lib/active_support/testing/file_fixtures.rb +38 -0
- data/lib/active_support/testing/isolation.rb +35 -26
- data/lib/active_support/testing/method_call_assertions.rb +70 -0
- data/lib/active_support/testing/parallelization.rb +134 -0
- data/lib/active_support/testing/setup_and_teardown.rb +13 -8
- data/lib/active_support/testing/stream.rb +43 -0
- data/lib/active_support/testing/tagged_logging.rb +3 -1
- data/lib/active_support/testing/time_helpers.rb +84 -20
- data/lib/active_support/time.rb +14 -12
- data/lib/active_support/time_with_zone.rb +179 -39
- data/lib/active_support/values/time_zone.rb +203 -63
- data/lib/active_support/version.rb +3 -1
- data/lib/active_support/xml_mini/jdom.rb +116 -115
- data/lib/active_support/xml_mini/libxml.rb +16 -13
- data/lib/active_support/xml_mini/libxmlsax.rb +15 -14
- data/lib/active_support/xml_mini/nokogiri.rb +14 -12
- data/lib/active_support/xml_mini/nokogirisax.rb +14 -13
- data/lib/active_support/xml_mini/rexml.rb +11 -9
- data/lib/active_support/xml_mini.rb +38 -46
- data/lib/active_support.rb +13 -11
- metadata +84 -26
- data/lib/active_support/concurrency/latch.rb +0 -27
- data/lib/active_support/core_ext/big_decimal/yaml_conversions.rb +0 -16
- data/lib/active_support/core_ext/class/delegating_attributes.rb +0 -45
- data/lib/active_support/core_ext/date_time/zones.rb +0 -6
- data/lib/active_support/core_ext/kernel/agnostics.rb +0 -11
- data/lib/active_support/core_ext/kernel/debugger.rb +0 -10
- data/lib/active_support/core_ext/module/method_transplanting.rb +0 -13
- data/lib/active_support/core_ext/module/qualified_const.rb +0 -52
- data/lib/active_support/core_ext/object/itself.rb +0 -15
- data/lib/active_support/core_ext/struct.rb +0 -6
- data/lib/active_support/core_ext/thread.rb +0 -86
- data/lib/active_support/core_ext/time/marshal.rb +0 -30
- data/lib/active_support/values/unicode_tables.dat +0 -0
@@ -1,9 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "time"
|
4
|
+
require "base64"
|
5
|
+
require "bigdecimal"
|
6
|
+
require "bigdecimal/util"
|
7
|
+
require "active_support/core_ext/module/delegation"
|
8
|
+
require "active_support/core_ext/string/inflections"
|
9
|
+
require "active_support/core_ext/date_time/calculations"
|
7
10
|
|
8
11
|
module ActiveSupport
|
9
12
|
# = XmlMini
|
@@ -20,11 +23,11 @@ module ActiveSupport
|
|
20
23
|
attr_writer :original_filename, :content_type
|
21
24
|
|
22
25
|
def original_filename
|
23
|
-
@original_filename ||
|
26
|
+
@original_filename || "untitled"
|
24
27
|
end
|
25
28
|
|
26
29
|
def content_type
|
27
|
-
@content_type ||
|
30
|
+
@content_type || "application/octet-stream"
|
28
31
|
end
|
29
32
|
end
|
30
33
|
|
@@ -46,10 +49,6 @@ module ActiveSupport
|
|
46
49
|
"Array" => "array",
|
47
50
|
"Hash" => "hash"
|
48
51
|
}
|
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
52
|
end
|
54
53
|
|
55
54
|
FORMATTING = {
|
@@ -70,18 +69,14 @@ module ActiveSupport
|
|
70
69
|
"float" => Proc.new { |float| float.to_f },
|
71
70
|
"decimal" => Proc.new do |number|
|
72
71
|
if String === number
|
73
|
-
|
74
|
-
BigDecimal(number)
|
75
|
-
rescue ArgumentError
|
76
|
-
BigDecimal('0')
|
77
|
-
end
|
72
|
+
number.to_d
|
78
73
|
else
|
79
74
|
BigDecimal(number)
|
80
75
|
end
|
81
76
|
end,
|
82
77
|
"boolean" => Proc.new { |boolean| %w(1 true).include?(boolean.to_s.strip) },
|
83
78
|
"string" => Proc.new { |string| string.to_s },
|
84
|
-
"yaml" => Proc.new { |yaml| YAML
|
79
|
+
"yaml" => Proc.new { |yaml| YAML.load(yaml) rescue yaml },
|
85
80
|
"base64Binary" => Proc.new { |bin| ::Base64.decode64(bin) },
|
86
81
|
"binary" => Proc.new { |bin, entity| _parse_binary(bin, entity) },
|
87
82
|
"file" => Proc.new { |file, entity| _parse_file(file, entity) }
|
@@ -96,7 +91,7 @@ module ActiveSupport
|
|
96
91
|
attr_accessor :depth
|
97
92
|
self.depth = 100
|
98
93
|
|
99
|
-
delegate :parse, :
|
94
|
+
delegate :parse, to: :backend
|
100
95
|
|
101
96
|
def backend
|
102
97
|
current_thread_backend || @backend
|
@@ -118,7 +113,7 @@ module ActiveSupport
|
|
118
113
|
|
119
114
|
def to_tag(key, value, options)
|
120
115
|
type_name = options.delete(:type)
|
121
|
-
merged_options = options.merge(:
|
116
|
+
merged_options = options.merge(root: key, skip_instruct: true)
|
122
117
|
|
123
118
|
if value.is_a?(::Method) || value.is_a?(::Proc)
|
124
119
|
if value.arity == 1
|
@@ -136,7 +131,7 @@ module ActiveSupport
|
|
136
131
|
|
137
132
|
key = rename_key(key.to_s, options)
|
138
133
|
|
139
|
-
attributes = options[:skip_types] || type_name.nil? ? {
|
134
|
+
attributes = options[:skip_types] || type_name.nil? ? {} : { type: type_name }
|
140
135
|
attributes[:nil] = true if value.nil?
|
141
136
|
|
142
137
|
encoding = options[:encoding] || DEFAULT_ENCODINGS[type_name]
|
@@ -159,33 +154,30 @@ module ActiveSupport
|
|
159
154
|
key
|
160
155
|
end
|
161
156
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
"#{left}#{middle.tr('_ ', '--')}#{right}"
|
168
|
-
end
|
169
|
-
|
170
|
-
# TODO: Add support for other encodings
|
171
|
-
def _parse_binary(bin, entity) #:nodoc:
|
172
|
-
case entity['encoding']
|
173
|
-
when 'base64'
|
174
|
-
::Base64.decode64(bin)
|
175
|
-
else
|
176
|
-
bin
|
157
|
+
private
|
158
|
+
def _dasherize(key)
|
159
|
+
# $2 must be a non-greedy regex for this to work
|
160
|
+
left, middle, right = /\A(_*)(.*?)(_*)\Z/.match(key.strip)[1, 3]
|
161
|
+
"#{left}#{middle.tr('_ ', '--')}#{right}"
|
177
162
|
end
|
178
|
-
end
|
179
163
|
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
164
|
+
# TODO: Add support for other encodings
|
165
|
+
def _parse_binary(bin, entity)
|
166
|
+
case entity["encoding"]
|
167
|
+
when "base64"
|
168
|
+
::Base64.decode64(bin)
|
169
|
+
else
|
170
|
+
bin
|
171
|
+
end
|
172
|
+
end
|
187
173
|
|
188
|
-
|
174
|
+
def _parse_file(file, entity)
|
175
|
+
f = StringIO.new(::Base64.decode64(file))
|
176
|
+
f.extend(FileLike)
|
177
|
+
f.original_filename = entity["name"]
|
178
|
+
f.content_type = entity["content_type"]
|
179
|
+
f
|
180
|
+
end
|
189
181
|
|
190
182
|
def current_thread_backend
|
191
183
|
Thread.current[:xml_mini_backend]
|
@@ -205,5 +197,5 @@ module ActiveSupport
|
|
205
197
|
end
|
206
198
|
end
|
207
199
|
|
208
|
-
XmlMini.backend =
|
200
|
+
XmlMini.backend = "REXML"
|
209
201
|
end
|
data/lib/active_support.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
#--
|
2
|
-
# Copyright (c) 2005-
|
4
|
+
# Copyright (c) 2005-2019 David Heinemeier Hansson
|
3
5
|
#
|
4
6
|
# Permission is hereby granted, free of charge, to any person obtaining
|
5
7
|
# a copy of this software and associated documentation files (the
|
@@ -21,7 +23,7 @@
|
|
21
23
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
24
|
#++
|
23
25
|
|
24
|
-
require
|
26
|
+
require "securerandom"
|
25
27
|
require "active_support/dependencies/autoload"
|
26
28
|
require "active_support/version"
|
27
29
|
require "active_support/logger"
|
@@ -32,11 +34,17 @@ module ActiveSupport
|
|
32
34
|
extend ActiveSupport::Autoload
|
33
35
|
|
34
36
|
autoload :Concern
|
37
|
+
autoload :ActionableError
|
38
|
+
autoload :CurrentAttributes
|
35
39
|
autoload :Dependencies
|
36
40
|
autoload :DescendantsTracker
|
41
|
+
autoload :ExecutionWrapper
|
42
|
+
autoload :Executor
|
37
43
|
autoload :FileUpdateChecker
|
44
|
+
autoload :EventedFileUpdateChecker
|
38
45
|
autoload :LogSubscriber
|
39
46
|
autoload :Notifications
|
47
|
+
autoload :Reloader
|
40
48
|
|
41
49
|
eager_autoload do
|
42
50
|
autoload :BacktraceCleaner
|
@@ -46,6 +54,7 @@ module ActiveSupport
|
|
46
54
|
autoload :Callbacks
|
47
55
|
autoload :Configurable
|
48
56
|
autoload :Deprecation
|
57
|
+
autoload :Digest
|
49
58
|
autoload :Gzip
|
50
59
|
autoload :Inflector
|
51
60
|
autoload :JSON
|
@@ -60,6 +69,7 @@ module ActiveSupport
|
|
60
69
|
autoload :StringInquirer
|
61
70
|
autoload :TaggedLogging
|
62
71
|
autoload :XmlMini
|
72
|
+
autoload :ArrayInquirer
|
63
73
|
end
|
64
74
|
|
65
75
|
autoload :Rescuable
|
@@ -72,15 +82,7 @@ module ActiveSupport
|
|
72
82
|
NumberHelper.eager_load!
|
73
83
|
end
|
74
84
|
|
75
|
-
|
76
|
-
|
77
|
-
def self.test_order=(new_order) # :nodoc:
|
78
|
-
@@test_order = new_order
|
79
|
-
end
|
80
|
-
|
81
|
-
def self.test_order # :nodoc:
|
82
|
-
@@test_order
|
83
|
-
end
|
85
|
+
cattr_accessor :test_order # :nodoc:
|
84
86
|
|
85
87
|
def self.to_time_preserves_timezone
|
86
88
|
DateAndTime::Compatibility.preserve_timezone
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activesupport
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 6.0.3.1
|
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:
|
11
|
+
date: 2020-05-18 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'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '2'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '0.7'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: tzinfo
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,25 +59,45 @@ dependencies:
|
|
53
59
|
- !ruby/object:Gem::Version
|
54
60
|
version: '5.1'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
62
|
+
name: concurrent-ruby
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '1.0'
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 1.0.2
|
71
|
+
type: :runtime
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '1.0'
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 1.0.2
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: zeitwerk
|
57
83
|
requirement: !ruby/object:Gem::Requirement
|
58
84
|
requirements:
|
59
85
|
- - "~>"
|
60
86
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
87
|
+
version: '2.2'
|
62
88
|
- - ">="
|
63
89
|
- !ruby/object:Gem::Version
|
64
|
-
version:
|
90
|
+
version: 2.2.2
|
65
91
|
type: :runtime
|
66
92
|
prerelease: false
|
67
93
|
version_requirements: !ruby/object:Gem::Requirement
|
68
94
|
requirements:
|
69
95
|
- - "~>"
|
70
96
|
- !ruby/object:Gem::Version
|
71
|
-
version: '
|
97
|
+
version: '2.2'
|
72
98
|
- - ">="
|
73
99
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
100
|
+
version: 2.2.2
|
75
101
|
description: A toolkit of support libraries and Ruby core extensions extracted from
|
76
102
|
the Rails framework. Rich support for multibyte strings, internationalization, time
|
77
103
|
zones, and testing.
|
@@ -84,7 +110,9 @@ files:
|
|
84
110
|
- MIT-LICENSE
|
85
111
|
- README.rdoc
|
86
112
|
- lib/active_support.rb
|
113
|
+
- lib/active_support/actionable_error.rb
|
87
114
|
- lib/active_support/all.rb
|
115
|
+
- lib/active_support/array_inquirer.rb
|
88
116
|
- lib/active_support/backtrace_cleaner.rb
|
89
117
|
- lib/active_support/benchmarkable.rb
|
90
118
|
- lib/active_support/builder.rb
|
@@ -93,31 +121,34 @@ files:
|
|
93
121
|
- lib/active_support/cache/mem_cache_store.rb
|
94
122
|
- lib/active_support/cache/memory_store.rb
|
95
123
|
- lib/active_support/cache/null_store.rb
|
124
|
+
- lib/active_support/cache/redis_cache_store.rb
|
96
125
|
- lib/active_support/cache/strategy/local_cache.rb
|
97
126
|
- lib/active_support/cache/strategy/local_cache_middleware.rb
|
98
127
|
- lib/active_support/callbacks.rb
|
99
128
|
- lib/active_support/concern.rb
|
100
|
-
- lib/active_support/concurrency/
|
129
|
+
- lib/active_support/concurrency/load_interlock_aware_monitor.rb
|
130
|
+
- lib/active_support/concurrency/share_lock.rb
|
101
131
|
- lib/active_support/configurable.rb
|
102
132
|
- lib/active_support/core_ext.rb
|
103
133
|
- lib/active_support/core_ext/array.rb
|
104
134
|
- lib/active_support/core_ext/array/access.rb
|
105
135
|
- lib/active_support/core_ext/array/conversions.rb
|
136
|
+
- lib/active_support/core_ext/array/extract.rb
|
106
137
|
- lib/active_support/core_ext/array/extract_options.rb
|
107
138
|
- lib/active_support/core_ext/array/grouping.rb
|
139
|
+
- lib/active_support/core_ext/array/inquiry.rb
|
108
140
|
- lib/active_support/core_ext/array/prepend_and_append.rb
|
109
141
|
- lib/active_support/core_ext/array/wrap.rb
|
110
142
|
- lib/active_support/core_ext/benchmark.rb
|
111
143
|
- lib/active_support/core_ext/big_decimal.rb
|
112
144
|
- lib/active_support/core_ext/big_decimal/conversions.rb
|
113
|
-
- lib/active_support/core_ext/big_decimal/yaml_conversions.rb
|
114
145
|
- lib/active_support/core_ext/class.rb
|
115
146
|
- lib/active_support/core_ext/class/attribute.rb
|
116
147
|
- lib/active_support/core_ext/class/attribute_accessors.rb
|
117
|
-
- lib/active_support/core_ext/class/delegating_attributes.rb
|
118
148
|
- lib/active_support/core_ext/class/subclasses.rb
|
119
149
|
- lib/active_support/core_ext/date.rb
|
120
150
|
- lib/active_support/core_ext/date/acts_like.rb
|
151
|
+
- lib/active_support/core_ext/date/blank.rb
|
121
152
|
- lib/active_support/core_ext/date/calculations.rb
|
122
153
|
- lib/active_support/core_ext/date/conversions.rb
|
123
154
|
- lib/active_support/core_ext/date/zones.rb
|
@@ -126,10 +157,11 @@ files:
|
|
126
157
|
- lib/active_support/core_ext/date_and_time/zones.rb
|
127
158
|
- lib/active_support/core_ext/date_time.rb
|
128
159
|
- lib/active_support/core_ext/date_time/acts_like.rb
|
160
|
+
- lib/active_support/core_ext/date_time/blank.rb
|
129
161
|
- lib/active_support/core_ext/date_time/calculations.rb
|
130
162
|
- lib/active_support/core_ext/date_time/compatibility.rb
|
131
163
|
- lib/active_support/core_ext/date_time/conversions.rb
|
132
|
-
- lib/active_support/core_ext/
|
164
|
+
- lib/active_support/core_ext/digest.rb
|
133
165
|
- lib/active_support/core_ext/digest/uuid.rb
|
134
166
|
- lib/active_support/core_ext/enumerable.rb
|
135
167
|
- lib/active_support/core_ext/file.rb
|
@@ -138,6 +170,7 @@ files:
|
|
138
170
|
- lib/active_support/core_ext/hash/compact.rb
|
139
171
|
- lib/active_support/core_ext/hash/conversions.rb
|
140
172
|
- lib/active_support/core_ext/hash/deep_merge.rb
|
173
|
+
- lib/active_support/core_ext/hash/deep_transform_values.rb
|
141
174
|
- lib/active_support/core_ext/hash/except.rb
|
142
175
|
- lib/active_support/core_ext/hash/indifferent_access.rb
|
143
176
|
- lib/active_support/core_ext/hash/keys.rb
|
@@ -149,9 +182,7 @@ files:
|
|
149
182
|
- lib/active_support/core_ext/integer/multiple.rb
|
150
183
|
- lib/active_support/core_ext/integer/time.rb
|
151
184
|
- lib/active_support/core_ext/kernel.rb
|
152
|
-
- lib/active_support/core_ext/kernel/agnostics.rb
|
153
185
|
- lib/active_support/core_ext/kernel/concern.rb
|
154
|
-
- lib/active_support/core_ext/kernel/debugger.rb
|
155
186
|
- lib/active_support/core_ext/kernel/reporting.rb
|
156
187
|
- lib/active_support/core_ext/kernel/singleton_class.rb
|
157
188
|
- lib/active_support/core_ext/load_error.rb
|
@@ -161,18 +192,19 @@ files:
|
|
161
192
|
- lib/active_support/core_ext/module/anonymous.rb
|
162
193
|
- lib/active_support/core_ext/module/attr_internal.rb
|
163
194
|
- lib/active_support/core_ext/module/attribute_accessors.rb
|
195
|
+
- lib/active_support/core_ext/module/attribute_accessors_per_thread.rb
|
164
196
|
- lib/active_support/core_ext/module/concerning.rb
|
165
197
|
- lib/active_support/core_ext/module/delegation.rb
|
166
198
|
- lib/active_support/core_ext/module/deprecation.rb
|
167
199
|
- lib/active_support/core_ext/module/introspection.rb
|
168
|
-
- lib/active_support/core_ext/module/method_transplanting.rb
|
169
|
-
- lib/active_support/core_ext/module/qualified_const.rb
|
170
200
|
- lib/active_support/core_ext/module/reachable.rb
|
201
|
+
- lib/active_support/core_ext/module/redefine_method.rb
|
171
202
|
- lib/active_support/core_ext/module/remove_method.rb
|
172
203
|
- lib/active_support/core_ext/name_error.rb
|
173
204
|
- lib/active_support/core_ext/numeric.rb
|
174
205
|
- lib/active_support/core_ext/numeric/bytes.rb
|
175
206
|
- lib/active_support/core_ext/numeric/conversions.rb
|
207
|
+
- lib/active_support/core_ext/numeric/inquiry.rb
|
176
208
|
- lib/active_support/core_ext/numeric/time.rb
|
177
209
|
- lib/active_support/core_ext/object.rb
|
178
210
|
- lib/active_support/core_ext/object/acts_like.rb
|
@@ -182,18 +214,20 @@ files:
|
|
182
214
|
- lib/active_support/core_ext/object/duplicable.rb
|
183
215
|
- lib/active_support/core_ext/object/inclusion.rb
|
184
216
|
- lib/active_support/core_ext/object/instance_variables.rb
|
185
|
-
- lib/active_support/core_ext/object/itself.rb
|
186
217
|
- lib/active_support/core_ext/object/json.rb
|
187
218
|
- lib/active_support/core_ext/object/to_param.rb
|
188
219
|
- lib/active_support/core_ext/object/to_query.rb
|
189
220
|
- lib/active_support/core_ext/object/try.rb
|
190
221
|
- lib/active_support/core_ext/object/with_options.rb
|
191
222
|
- lib/active_support/core_ext/range.rb
|
223
|
+
- lib/active_support/core_ext/range/compare_range.rb
|
192
224
|
- lib/active_support/core_ext/range/conversions.rb
|
193
225
|
- lib/active_support/core_ext/range/each.rb
|
194
226
|
- lib/active_support/core_ext/range/include_range.rb
|
227
|
+
- lib/active_support/core_ext/range/include_time_with_zone.rb
|
195
228
|
- lib/active_support/core_ext/range/overlaps.rb
|
196
229
|
- lib/active_support/core_ext/regexp.rb
|
230
|
+
- lib/active_support/core_ext/securerandom.rb
|
197
231
|
- lib/active_support/core_ext/string.rb
|
198
232
|
- lib/active_support/core_ext/string/access.rb
|
199
233
|
- lib/active_support/core_ext/string/behavior.rb
|
@@ -208,26 +242,35 @@ files:
|
|
208
242
|
- lib/active_support/core_ext/string/starts_ends_with.rb
|
209
243
|
- lib/active_support/core_ext/string/strip.rb
|
210
244
|
- lib/active_support/core_ext/string/zones.rb
|
211
|
-
- lib/active_support/core_ext/struct.rb
|
212
|
-
- lib/active_support/core_ext/thread.rb
|
213
245
|
- lib/active_support/core_ext/time.rb
|
214
246
|
- lib/active_support/core_ext/time/acts_like.rb
|
215
247
|
- lib/active_support/core_ext/time/calculations.rb
|
216
248
|
- lib/active_support/core_ext/time/compatibility.rb
|
217
249
|
- lib/active_support/core_ext/time/conversions.rb
|
218
|
-
- lib/active_support/core_ext/time/marshal.rb
|
219
250
|
- lib/active_support/core_ext/time/zones.rb
|
220
251
|
- lib/active_support/core_ext/uri.rb
|
252
|
+
- lib/active_support/current_attributes.rb
|
221
253
|
- lib/active_support/dependencies.rb
|
222
254
|
- lib/active_support/dependencies/autoload.rb
|
255
|
+
- lib/active_support/dependencies/interlock.rb
|
256
|
+
- lib/active_support/dependencies/zeitwerk_integration.rb
|
223
257
|
- lib/active_support/deprecation.rb
|
224
258
|
- lib/active_support/deprecation/behaviors.rb
|
259
|
+
- lib/active_support/deprecation/constant_accessor.rb
|
225
260
|
- lib/active_support/deprecation/instance_delegator.rb
|
226
261
|
- lib/active_support/deprecation/method_wrappers.rb
|
227
262
|
- lib/active_support/deprecation/proxy_wrappers.rb
|
228
263
|
- lib/active_support/deprecation/reporting.rb
|
229
264
|
- lib/active_support/descendants_tracker.rb
|
265
|
+
- lib/active_support/digest.rb
|
230
266
|
- lib/active_support/duration.rb
|
267
|
+
- lib/active_support/duration/iso8601_parser.rb
|
268
|
+
- lib/active_support/duration/iso8601_serializer.rb
|
269
|
+
- lib/active_support/encrypted_configuration.rb
|
270
|
+
- lib/active_support/encrypted_file.rb
|
271
|
+
- lib/active_support/evented_file_update_checker.rb
|
272
|
+
- lib/active_support/execution_wrapper.rb
|
273
|
+
- lib/active_support/executor.rb
|
231
274
|
- lib/active_support/file_update_checker.rb
|
232
275
|
- lib/active_support/gem_version.rb
|
233
276
|
- lib/active_support/gzip.rb
|
@@ -244,6 +287,7 @@ files:
|
|
244
287
|
- lib/active_support/json/encoding.rb
|
245
288
|
- lib/active_support/key_generator.rb
|
246
289
|
- lib/active_support/lazy_load_hooks.rb
|
290
|
+
- lib/active_support/locale/en.rb
|
247
291
|
- lib/active_support/locale/en.yml
|
248
292
|
- lib/active_support/log_subscriber.rb
|
249
293
|
- lib/active_support/log_subscriber/test_helper.rb
|
@@ -252,6 +296,9 @@ files:
|
|
252
296
|
- lib/active_support/logger_thread_safe_level.rb
|
253
297
|
- lib/active_support/message_encryptor.rb
|
254
298
|
- lib/active_support/message_verifier.rb
|
299
|
+
- lib/active_support/messages/metadata.rb
|
300
|
+
- lib/active_support/messages/rotation_configuration.rb
|
301
|
+
- lib/active_support/messages/rotator.rb
|
255
302
|
- lib/active_support/multibyte.rb
|
256
303
|
- lib/active_support/multibyte/chars.rb
|
257
304
|
- lib/active_support/multibyte/unicode.rb
|
@@ -267,13 +314,16 @@ files:
|
|
267
314
|
- lib/active_support/number_helper/number_to_percentage_converter.rb
|
268
315
|
- lib/active_support/number_helper/number_to_phone_converter.rb
|
269
316
|
- lib/active_support/number_helper/number_to_rounded_converter.rb
|
317
|
+
- lib/active_support/number_helper/rounding_helper.rb
|
270
318
|
- lib/active_support/option_merger.rb
|
271
319
|
- lib/active_support/ordered_hash.rb
|
272
320
|
- lib/active_support/ordered_options.rb
|
321
|
+
- lib/active_support/parameter_filter.rb
|
273
322
|
- lib/active_support/per_thread_registry.rb
|
274
323
|
- lib/active_support/proxy_object.rb
|
275
324
|
- lib/active_support/rails.rb
|
276
325
|
- lib/active_support/railtie.rb
|
326
|
+
- lib/active_support/reloader.rb
|
277
327
|
- lib/active_support/rescuable.rb
|
278
328
|
- lib/active_support/security_utils.rb
|
279
329
|
- lib/active_support/string_inquirer.rb
|
@@ -285,14 +335,17 @@ files:
|
|
285
335
|
- lib/active_support/testing/constant_lookup.rb
|
286
336
|
- lib/active_support/testing/declarative.rb
|
287
337
|
- lib/active_support/testing/deprecation.rb
|
338
|
+
- lib/active_support/testing/file_fixtures.rb
|
288
339
|
- lib/active_support/testing/isolation.rb
|
340
|
+
- lib/active_support/testing/method_call_assertions.rb
|
341
|
+
- lib/active_support/testing/parallelization.rb
|
289
342
|
- lib/active_support/testing/setup_and_teardown.rb
|
343
|
+
- lib/active_support/testing/stream.rb
|
290
344
|
- lib/active_support/testing/tagged_logging.rb
|
291
345
|
- lib/active_support/testing/time_helpers.rb
|
292
346
|
- lib/active_support/time.rb
|
293
347
|
- lib/active_support/time_with_zone.rb
|
294
348
|
- lib/active_support/values/time_zone.rb
|
295
|
-
- lib/active_support/values/unicode_tables.dat
|
296
349
|
- lib/active_support/version.rb
|
297
350
|
- lib/active_support/xml_mini.rb
|
298
351
|
- lib/active_support/xml_mini/jdom.rb
|
@@ -301,10 +354,15 @@ files:
|
|
301
354
|
- lib/active_support/xml_mini/nokogiri.rb
|
302
355
|
- lib/active_support/xml_mini/nokogirisax.rb
|
303
356
|
- lib/active_support/xml_mini/rexml.rb
|
304
|
-
homepage:
|
357
|
+
homepage: https://rubyonrails.org
|
305
358
|
licenses:
|
306
359
|
- MIT
|
307
|
-
metadata:
|
360
|
+
metadata:
|
361
|
+
bug_tracker_uri: https://github.com/rails/rails/issues
|
362
|
+
changelog_uri: https://github.com/rails/rails/blob/v6.0.3.1/activesupport/CHANGELOG.md
|
363
|
+
documentation_uri: https://api.rubyonrails.org/v6.0.3.1/
|
364
|
+
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
365
|
+
source_code_uri: https://github.com/rails/rails/tree/v6.0.3.1/activesupport
|
308
366
|
post_install_message:
|
309
367
|
rdoc_options:
|
310
368
|
- "--encoding"
|
@@ -315,14 +373,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
315
373
|
requirements:
|
316
374
|
- - ">="
|
317
375
|
- !ruby/object:Gem::Version
|
318
|
-
version:
|
376
|
+
version: 2.5.0
|
319
377
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
320
378
|
requirements:
|
321
379
|
- - ">="
|
322
380
|
- !ruby/object:Gem::Version
|
323
381
|
version: '0'
|
324
382
|
requirements: []
|
325
|
-
rubygems_version: 3.
|
383
|
+
rubygems_version: 3.1.2
|
326
384
|
signing_key:
|
327
385
|
specification_version: 4
|
328
386
|
summary: A toolkit of support libraries and Ruby core extensions extracted from the
|
@@ -1,27 +0,0 @@
|
|
1
|
-
require 'thread'
|
2
|
-
require 'monitor'
|
3
|
-
|
4
|
-
module ActiveSupport
|
5
|
-
module Concurrency
|
6
|
-
class Latch
|
7
|
-
def initialize(count = 1)
|
8
|
-
@count = count
|
9
|
-
@lock = Monitor.new
|
10
|
-
@cv = @lock.new_cond
|
11
|
-
end
|
12
|
-
|
13
|
-
def release
|
14
|
-
@lock.synchronize do
|
15
|
-
@count -= 1 if @count > 0
|
16
|
-
@cv.broadcast if @count.zero?
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def await
|
21
|
-
@lock.synchronize do
|
22
|
-
@cv.wait_while { @count > 0 }
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
require 'active_support/deprecation'
|
2
|
-
|
3
|
-
ActiveSupport::Deprecation.warn 'core_ext/big_decimal/yaml_conversions is deprecated and will be removed in the future.'
|
4
|
-
|
5
|
-
require 'bigdecimal'
|
6
|
-
require 'yaml'
|
7
|
-
require 'active_support/core_ext/big_decimal/conversions'
|
8
|
-
|
9
|
-
class BigDecimal
|
10
|
-
YAML_MAPPING = { 'Infinity' => '.Inf', '-Infinity' => '-.Inf', 'NaN' => '.NaN' }
|
11
|
-
|
12
|
-
def encode_with(coder)
|
13
|
-
string = to_s
|
14
|
-
coder.represent_scalar(nil, YAML_MAPPING[string] || string)
|
15
|
-
end
|
16
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'active_support/core_ext/kernel/singleton_class'
|
2
|
-
require 'active_support/core_ext/module/remove_method'
|
3
|
-
require 'active_support/core_ext/module/deprecation'
|
4
|
-
|
5
|
-
|
6
|
-
class Class
|
7
|
-
def superclass_delegating_accessor(name, options = {})
|
8
|
-
# Create private _name and _name= methods that can still be used if the public
|
9
|
-
# methods are overridden.
|
10
|
-
_superclass_delegating_accessor("_#{name}", options)
|
11
|
-
|
12
|
-
# Generate the public methods name, name=, and name?.
|
13
|
-
# These methods dispatch to the private _name, and _name= methods, making them
|
14
|
-
# overridable.
|
15
|
-
singleton_class.send(:define_method, name) { send("_#{name}") }
|
16
|
-
singleton_class.send(:define_method, "#{name}?") { !!send("_#{name}") }
|
17
|
-
singleton_class.send(:define_method, "#{name}=") { |value| send("_#{name}=", value) }
|
18
|
-
|
19
|
-
# If an instance_reader is needed, generate public instance methods name and name?.
|
20
|
-
if options[:instance_reader] != false
|
21
|
-
define_method(name) { send("_#{name}") }
|
22
|
-
define_method("#{name}?") { !!send("#{name}") }
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
deprecate superclass_delegating_accessor: :class_attribute
|
27
|
-
|
28
|
-
private
|
29
|
-
# Take the object being set and store it in a method. This gives us automatic
|
30
|
-
# inheritance behavior, without having to store the object in an instance
|
31
|
-
# variable and look up the superclass chain manually.
|
32
|
-
def _stash_object_in_method(object, method, instance_reader = true)
|
33
|
-
singleton_class.remove_possible_method(method)
|
34
|
-
singleton_class.send(:define_method, method) { object }
|
35
|
-
remove_possible_method(method)
|
36
|
-
define_method(method) { object } if instance_reader
|
37
|
-
end
|
38
|
-
|
39
|
-
def _superclass_delegating_accessor(name, options = {})
|
40
|
-
singleton_class.send(:define_method, "#{name}=") do |value|
|
41
|
-
_stash_object_in_method(value, name, options[:instance_reader] != false)
|
42
|
-
end
|
43
|
-
send("#{name}=", nil)
|
44
|
-
end
|
45
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
class Object
|
2
|
-
# Makes backticks behave (somewhat more) similarly on all platforms.
|
3
|
-
# On win32 `nonexistent_command` raises Errno::ENOENT; on Unix, the
|
4
|
-
# spawned shell prints a message to stderr and sets $?. We emulate
|
5
|
-
# Unix on the former but not the latter.
|
6
|
-
def `(command) #:nodoc:
|
7
|
-
super
|
8
|
-
rescue Errno::ENOENT => e
|
9
|
-
STDERR.puts "#$0: #{e}"
|
10
|
-
end
|
11
|
-
end
|
@@ -1,10 +0,0 @@
|
|
1
|
-
module Kernel
|
2
|
-
unless respond_to?(:debugger)
|
3
|
-
# Starts a debugging session if the +debugger+ gem has been loaded (call rails server --debugger to do load it).
|
4
|
-
def debugger
|
5
|
-
message = "\n***** Debugger requested, but was not available (ensure the debugger gem is listed in Gemfile/installed as gem): Start server with --debugger to enable *****\n"
|
6
|
-
defined?(Rails.logger) ? Rails.logger.info(message) : $stderr.puts(message)
|
7
|
-
end
|
8
|
-
alias breakpoint debugger unless respond_to?(:breakpoint)
|
9
|
-
end
|
10
|
-
end
|