activesupport 5.1.7 → 6.1.7
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 +434 -490
- data/MIT-LICENSE +1 -1
- data/README.rdoc +6 -5
- data/lib/active_support/actionable_error.rb +48 -0
- data/lib/active_support/all.rb +2 -0
- data/lib/active_support/array_inquirer.rb +6 -2
- data/lib/active_support/backtrace_cleaner.rb +31 -3
- data/lib/active_support/benchmarkable.rb +3 -1
- data/lib/active_support/builder.rb +2 -0
- data/lib/active_support/cache/file_store.rb +37 -36
- data/lib/active_support/cache/mem_cache_store.rb +72 -56
- data/lib/active_support/cache/memory_store.rb +61 -33
- data/lib/active_support/cache/null_store.rb +10 -3
- data/lib/active_support/cache/redis_cache_store.rb +493 -0
- data/lib/active_support/cache/strategy/local_cache.rb +67 -21
- data/lib/active_support/cache/strategy/local_cache_middleware.rb +2 -0
- data/lib/active_support/cache.rb +310 -126
- data/lib/active_support/callbacks.rb +106 -100
- data/lib/active_support/concern.rb +79 -6
- data/lib/active_support/concurrency/load_interlock_aware_monitor.rb +18 -0
- data/lib/active_support/concurrency/share_lock.rb +2 -1
- data/lib/active_support/configurable.rb +12 -14
- data/lib/active_support/configuration_file.rb +51 -0
- data/lib/active_support/core_ext/array/access.rb +21 -7
- data/lib/active_support/core_ext/array/conversions.rb +7 -5
- 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 +2 -0
- data/lib/active_support/core_ext/array/inquiry.rb +2 -0
- data/lib/active_support/core_ext/array/wrap.rb +2 -0
- data/lib/active_support/core_ext/array.rb +3 -1
- data/lib/active_support/core_ext/benchmark.rb +4 -2
- data/lib/active_support/core_ext/big_decimal/conversions.rb +2 -0
- data/lib/active_support/core_ext/big_decimal.rb +2 -0
- data/lib/active_support/core_ext/class/attribute.rb +50 -47
- data/lib/active_support/core_ext/class/attribute_accessors.rb +2 -0
- data/lib/active_support/core_ext/class/subclasses.rb +18 -40
- data/lib/active_support/core_ext/class.rb +2 -0
- data/lib/active_support/core_ext/date/acts_like.rb +2 -0
- data/lib/active_support/core_ext/date/blank.rb +2 -0
- data/lib/active_support/core_ext/date/calculations.rb +8 -5
- data/lib/active_support/core_ext/date/conversions.rb +12 -10
- data/lib/active_support/core_ext/date/zones.rb +2 -0
- data/lib/active_support/core_ext/date.rb +2 -0
- data/lib/active_support/core_ext/date_and_time/calculations.rb +61 -37
- data/lib/active_support/core_ext/date_and_time/compatibility.rb +18 -1
- data/lib/active_support/core_ext/date_and_time/zones.rb +2 -1
- data/lib/active_support/core_ext/date_time/acts_like.rb +2 -0
- data/lib/active_support/core_ext/date_time/blank.rb +2 -0
- data/lib/active_support/core_ext/date_time/calculations.rb +3 -1
- data/lib/active_support/core_ext/date_time/compatibility.rb +7 -5
- data/lib/active_support/core_ext/date_time/conversions.rb +2 -1
- data/lib/active_support/core_ext/date_time.rb +2 -0
- data/lib/active_support/core_ext/digest/uuid.rb +4 -1
- data/lib/active_support/core_ext/digest.rb +3 -0
- data/lib/active_support/core_ext/enumerable.rb +174 -71
- data/lib/active_support/core_ext/file/atomic.rb +3 -1
- data/lib/active_support/core_ext/file.rb +2 -0
- data/lib/active_support/core_ext/hash/conversions.rb +7 -5
- data/lib/active_support/core_ext/hash/deep_merge.rb +8 -12
- data/lib/active_support/core_ext/hash/deep_transform_values.rb +46 -0
- data/lib/active_support/core_ext/hash/except.rb +4 -2
- data/lib/active_support/core_ext/hash/indifferent_access.rb +2 -0
- data/lib/active_support/core_ext/hash/keys.rb +3 -30
- data/lib/active_support/core_ext/hash/reverse_merge.rb +5 -2
- data/lib/active_support/core_ext/hash/slice.rb +8 -29
- data/lib/active_support/core_ext/hash.rb +3 -2
- data/lib/active_support/core_ext/integer/inflections.rb +2 -0
- data/lib/active_support/core_ext/integer/multiple.rb +3 -1
- data/lib/active_support/core_ext/integer/time.rb +7 -14
- data/lib/active_support/core_ext/integer.rb +2 -0
- data/lib/active_support/core_ext/kernel/concern.rb +2 -0
- data/lib/active_support/core_ext/kernel/reporting.rb +2 -0
- data/lib/active_support/core_ext/kernel/singleton_class.rb +2 -0
- data/lib/active_support/core_ext/kernel.rb +2 -1
- data/lib/active_support/core_ext/load_error.rb +3 -8
- data/lib/active_support/core_ext/marshal.rb +4 -0
- data/lib/active_support/core_ext/module/aliasing.rb +2 -0
- data/lib/active_support/core_ext/module/anonymous.rb +2 -0
- data/lib/active_support/core_ext/module/attr_internal.rb +4 -2
- data/lib/active_support/core_ext/module/attribute_accessors.rb +44 -56
- data/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +18 -18
- data/lib/active_support/core_ext/module/concerning.rb +15 -10
- data/lib/active_support/core_ext/module/delegation.rb +103 -58
- data/lib/active_support/core_ext/module/deprecation.rb +2 -0
- data/lib/active_support/core_ext/module/introspection.rb +18 -15
- data/lib/active_support/core_ext/module/redefine_method.rb +40 -0
- data/lib/active_support/core_ext/module/remove_method.rb +5 -23
- data/lib/active_support/core_ext/module.rb +3 -1
- data/lib/active_support/core_ext/name_error.rb +36 -2
- data/lib/active_support/core_ext/numeric/bytes.rb +2 -0
- data/lib/active_support/core_ext/numeric/conversions.rb +131 -129
- data/lib/active_support/core_ext/numeric/time.rb +7 -15
- data/lib/active_support/core_ext/numeric.rb +2 -1
- data/lib/active_support/core_ext/object/acts_like.rb +12 -1
- data/lib/active_support/core_ext/object/blank.rb +13 -3
- data/lib/active_support/core_ext/object/conversions.rb +2 -0
- data/lib/active_support/core_ext/object/deep_dup.rb +3 -1
- data/lib/active_support/core_ext/object/duplicable.rb +9 -114
- data/lib/active_support/core_ext/object/inclusion.rb +2 -0
- data/lib/active_support/core_ext/object/instance_variables.rb +2 -0
- data/lib/active_support/core_ext/object/json.rb +22 -2
- data/lib/active_support/core_ext/object/to_param.rb +2 -0
- data/lib/active_support/core_ext/object/to_query.rb +2 -0
- data/lib/active_support/core_ext/object/try.rb +19 -7
- data/lib/active_support/core_ext/object/with_options.rb +4 -2
- data/lib/active_support/core_ext/object.rb +2 -0
- data/lib/active_support/core_ext/range/compare_range.rb +82 -0
- data/lib/active_support/core_ext/range/conversions.rb +35 -25
- data/lib/active_support/core_ext/range/each.rb +5 -2
- data/lib/active_support/core_ext/range/include_time_with_zone.rb +28 -0
- data/lib/active_support/core_ext/range/overlaps.rb +2 -0
- data/lib/active_support/core_ext/range.rb +4 -1
- data/lib/active_support/core_ext/regexp.rb +10 -5
- data/lib/active_support/core_ext/securerandom.rb +25 -3
- data/lib/active_support/core_ext/string/access.rb +7 -16
- data/lib/active_support/core_ext/string/behavior.rb +2 -0
- data/lib/active_support/core_ext/string/conversions.rb +3 -0
- data/lib/active_support/core_ext/string/exclude.rb +2 -0
- data/lib/active_support/core_ext/string/filters.rb +44 -1
- data/lib/active_support/core_ext/string/indent.rb +2 -0
- data/lib/active_support/core_ext/string/inflections.rb +69 -16
- data/lib/active_support/core_ext/string/inquiry.rb +3 -0
- data/lib/active_support/core_ext/string/multibyte.rb +9 -4
- data/lib/active_support/core_ext/string/output_safety.rb +104 -20
- data/lib/active_support/core_ext/string/starts_ends_with.rb +4 -2
- data/lib/active_support/core_ext/string/strip.rb +5 -1
- data/lib/active_support/core_ext/string/zones.rb +2 -0
- data/lib/active_support/core_ext/string.rb +2 -0
- data/lib/active_support/core_ext/symbol/starts_ends_with.rb +14 -0
- data/lib/active_support/core_ext/symbol.rb +3 -0
- data/lib/active_support/core_ext/time/acts_like.rb +2 -0
- data/lib/active_support/core_ext/time/calculations.rb +76 -18
- data/lib/active_support/core_ext/time/compatibility.rb +4 -2
- data/lib/active_support/core_ext/time/conversions.rb +4 -0
- data/lib/active_support/core_ext/time/zones.rb +6 -4
- data/lib/active_support/core_ext/time.rb +2 -0
- data/lib/active_support/core_ext/uri.rb +11 -6
- data/lib/active_support/core_ext.rb +3 -1
- data/lib/active_support/current_attributes/test_helper.rb +13 -0
- data/lib/active_support/current_attributes.rb +210 -0
- data/lib/active_support/dependencies/autoload.rb +2 -0
- data/lib/active_support/dependencies/interlock.rb +2 -0
- data/lib/active_support/dependencies/zeitwerk_integration.rb +120 -0
- data/lib/active_support/dependencies.rb +134 -60
- data/lib/active_support/deprecation/behaviors.rb +43 -11
- data/lib/active_support/deprecation/constant_accessor.rb +4 -2
- data/lib/active_support/deprecation/disallowed.rb +56 -0
- data/lib/active_support/deprecation/instance_delegator.rb +2 -1
- data/lib/active_support/deprecation/method_wrappers.rb +29 -21
- data/lib/active_support/deprecation/proxy_wrappers.rb +32 -6
- data/lib/active_support/deprecation/reporting.rb +54 -9
- data/lib/active_support/deprecation.rb +9 -2
- data/lib/active_support/descendants_tracker.rb +61 -9
- data/lib/active_support/digest.rb +22 -0
- data/lib/active_support/duration/iso8601_parser.rb +6 -6
- data/lib/active_support/duration/iso8601_serializer.rb +20 -14
- data/lib/active_support/duration.rb +102 -45
- data/lib/active_support/encrypted_configuration.rb +45 -0
- data/lib/active_support/encrypted_file.rb +117 -0
- data/lib/active_support/environment_inquirer.rb +20 -0
- data/lib/active_support/evented_file_update_checker.rb +84 -117
- data/lib/active_support/execution_wrapper.rb +19 -13
- data/lib/active_support/executor.rb +2 -0
- data/lib/active_support/file_update_checker.rb +2 -1
- data/lib/active_support/fork_tracker.rb +64 -0
- data/lib/active_support/gem_version.rb +3 -1
- data/lib/active_support/gzip.rb +2 -0
- data/lib/active_support/hash_with_indifferent_access.rb +123 -41
- data/lib/active_support/i18n.rb +4 -1
- data/lib/active_support/i18n_railtie.rb +19 -14
- data/lib/active_support/inflections.rb +2 -0
- data/lib/active_support/inflector/inflections.rb +19 -8
- data/lib/active_support/inflector/methods.rb +87 -77
- data/lib/active_support/inflector/transliterate.rb +56 -18
- data/lib/active_support/inflector.rb +2 -0
- data/lib/active_support/json/decoding.rb +27 -26
- data/lib/active_support/json/encoding.rb +13 -3
- data/lib/active_support/json.rb +2 -0
- data/lib/active_support/key_generator.rb +3 -33
- data/lib/active_support/lazy_load_hooks.rb +7 -2
- data/lib/active_support/locale/en.rb +33 -0
- data/lib/active_support/locale/en.yml +7 -3
- data/lib/active_support/log_subscriber/test_helper.rb +2 -0
- data/lib/active_support/log_subscriber.rb +42 -11
- data/lib/active_support/logger.rb +4 -17
- data/lib/active_support/logger_silence.rb +13 -20
- data/lib/active_support/logger_thread_safe_level.rb +54 -7
- data/lib/active_support/message_encryptor.rb +100 -32
- data/lib/active_support/message_verifier.rb +85 -14
- data/lib/active_support/messages/metadata.rb +80 -0
- data/lib/active_support/messages/rotation_configuration.rb +23 -0
- data/lib/active_support/messages/rotator.rb +57 -0
- data/lib/active_support/multibyte/chars.rb +12 -68
- data/lib/active_support/multibyte/unicode.rb +17 -327
- data/lib/active_support/multibyte.rb +2 -0
- data/lib/active_support/notifications/fanout.rb +118 -16
- data/lib/active_support/notifications/instrumenter.rb +73 -9
- data/lib/active_support/notifications.rb +74 -8
- data/lib/active_support/number_helper/number_converter.rb +7 -6
- data/lib/active_support/number_helper/number_to_currency_converter.rb +6 -9
- data/lib/active_support/number_helper/number_to_delimited_converter.rb +5 -2
- data/lib/active_support/number_helper/number_to_human_converter.rb +6 -3
- data/lib/active_support/number_helper/number_to_human_size_converter.rb +6 -3
- data/lib/active_support/number_helper/number_to_percentage_converter.rb +5 -1
- data/lib/active_support/number_helper/number_to_phone_converter.rb +5 -2
- data/lib/active_support/number_helper/number_to_rounded_converter.rb +14 -27
- data/lib/active_support/number_helper/rounding_helper.rb +16 -30
- data/lib/active_support/number_helper.rb +40 -12
- data/lib/active_support/option_merger.rb +24 -3
- data/lib/active_support/ordered_hash.rb +3 -1
- data/lib/active_support/ordered_options.rb +17 -5
- data/lib/active_support/parameter_filter.rb +133 -0
- data/lib/active_support/per_thread_registry.rb +4 -1
- data/lib/active_support/proxy_object.rb +2 -0
- data/lib/active_support/rails.rb +3 -10
- data/lib/active_support/railtie.rb +60 -9
- data/lib/active_support/reloader.rb +12 -11
- data/lib/active_support/rescuable.rb +7 -6
- data/lib/active_support/secure_compare_rotator.rb +51 -0
- data/lib/active_support/security_utils.rb +26 -15
- data/lib/active_support/string_inquirer.rb +6 -3
- data/lib/active_support/subscriber.rb +74 -24
- data/lib/active_support/tagged_logging.rb +44 -8
- data/lib/active_support/test_case.rb +94 -2
- data/lib/active_support/testing/assertions.rb +58 -20
- data/lib/active_support/testing/autorun.rb +2 -0
- data/lib/active_support/testing/constant_lookup.rb +2 -0
- data/lib/active_support/testing/declarative.rb +2 -0
- data/lib/active_support/testing/deprecation.rb +2 -1
- data/lib/active_support/testing/file_fixtures.rb +4 -0
- data/lib/active_support/testing/isolation.rb +4 -2
- data/lib/active_support/testing/method_call_assertions.rb +30 -1
- data/lib/active_support/testing/parallelization/server.rb +78 -0
- data/lib/active_support/testing/parallelization/worker.rb +100 -0
- data/lib/active_support/testing/parallelization.rb +51 -0
- data/lib/active_support/testing/setup_and_teardown.rb +12 -7
- data/lib/active_support/testing/stream.rb +3 -2
- data/lib/active_support/testing/tagged_logging.rb +2 -0
- data/lib/active_support/testing/time_helpers.rb +78 -13
- data/lib/active_support/time.rb +2 -0
- data/lib/active_support/time_with_zone.rb +113 -41
- data/lib/active_support/values/time_zone.rb +54 -25
- data/lib/active_support/version.rb +2 -0
- data/lib/active_support/xml_mini/jdom.rb +5 -4
- data/lib/active_support/xml_mini/libxml.rb +4 -2
- data/lib/active_support/xml_mini/libxmlsax.rb +6 -4
- data/lib/active_support/xml_mini/nokogiri.rb +4 -2
- data/lib/active_support/xml_mini/nokogirisax.rb +5 -3
- data/lib/active_support/xml_mini/rexml.rb +12 -3
- data/lib/active_support/xml_mini.rb +5 -11
- data/lib/active_support.rb +18 -13
- metadata +71 -32
- data/lib/active_support/core_ext/array/prepend_and_append.rb +0 -7
- data/lib/active_support/core_ext/hash/compact.rb +0 -27
- data/lib/active_support/core_ext/hash/transform_values.rb +0 -30
- data/lib/active_support/core_ext/kernel/agnostics.rb +0 -11
- data/lib/active_support/core_ext/module/reachable.rb +0 -8
- data/lib/active_support/core_ext/numeric/inquiry.rb +0 -26
- data/lib/active_support/core_ext/range/include_range.rb +0 -23
- data/lib/active_support/values/unicode_tables.dat +0 -0
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "active_support/core_ext/kernel/reporting"
|
2
4
|
require "active_support/core_ext/object/blank"
|
3
5
|
require "stringio"
|
@@ -6,7 +8,7 @@ module ActiveSupport
|
|
6
8
|
module XmlMini_REXML #:nodoc:
|
7
9
|
extend self
|
8
10
|
|
9
|
-
CONTENT_KEY = "__content__"
|
11
|
+
CONTENT_KEY = "__content__"
|
10
12
|
|
11
13
|
# Parse an XML Document string or IO into a simple hash.
|
12
14
|
#
|
@@ -23,7 +25,7 @@ module ActiveSupport
|
|
23
25
|
if data.eof?
|
24
26
|
{}
|
25
27
|
else
|
26
|
-
|
28
|
+
require_rexml unless defined?(REXML::Document)
|
27
29
|
doc = REXML::Document.new(data)
|
28
30
|
|
29
31
|
if doc.root
|
@@ -36,6 +38,13 @@ module ActiveSupport
|
|
36
38
|
end
|
37
39
|
|
38
40
|
private
|
41
|
+
def require_rexml
|
42
|
+
silence_warnings { require "rexml/document" }
|
43
|
+
rescue LoadError => e
|
44
|
+
$stderr.puts "You don't have rexml installed in your application. Please add it to your Gemfile and run bundle install"
|
45
|
+
raise e
|
46
|
+
end
|
47
|
+
|
39
48
|
# Convert an XML element and merge into the hash
|
40
49
|
#
|
41
50
|
# hash::
|
@@ -74,7 +83,7 @@ module ActiveSupport
|
|
74
83
|
hash
|
75
84
|
else
|
76
85
|
# must use value to prevent double-escaping
|
77
|
-
texts = ""
|
86
|
+
texts = +""
|
78
87
|
element.texts.each { |t| texts << t.value }
|
79
88
|
merge!(hash, CONTENT_KEY, texts)
|
80
89
|
end
|
@@ -1,6 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "time"
|
2
4
|
require "base64"
|
3
5
|
require "bigdecimal"
|
6
|
+
require "bigdecimal/util"
|
4
7
|
require "active_support/core_ext/module/delegation"
|
5
8
|
require "active_support/core_ext/string/inflections"
|
6
9
|
require "active_support/core_ext/date_time/calculations"
|
@@ -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) }
|
@@ -160,7 +155,6 @@ module ActiveSupport
|
|
160
155
|
end
|
161
156
|
|
162
157
|
private
|
163
|
-
|
164
158
|
def _dasherize(key)
|
165
159
|
# $2 must be a non-greedy regex for this to work
|
166
160
|
left, middle, right = /\A(_*)(.*?)(_*)\Z/.match(key.strip)[1, 3]
|
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-2022 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
|
@@ -32,15 +34,20 @@ module ActiveSupport
|
|
32
34
|
extend ActiveSupport::Autoload
|
33
35
|
|
34
36
|
autoload :Concern
|
37
|
+
autoload :ActionableError
|
38
|
+
autoload :ConfigurationFile
|
39
|
+
autoload :CurrentAttributes
|
35
40
|
autoload :Dependencies
|
36
41
|
autoload :DescendantsTracker
|
37
42
|
autoload :ExecutionWrapper
|
38
43
|
autoload :Executor
|
39
44
|
autoload :FileUpdateChecker
|
40
45
|
autoload :EventedFileUpdateChecker
|
46
|
+
autoload :ForkTracker
|
41
47
|
autoload :LogSubscriber
|
42
48
|
autoload :Notifications
|
43
49
|
autoload :Reloader
|
50
|
+
autoload :SecureCompareRotator
|
44
51
|
|
45
52
|
eager_autoload do
|
46
53
|
autoload :BacktraceCleaner
|
@@ -50,6 +57,7 @@ module ActiveSupport
|
|
50
57
|
autoload :Callbacks
|
51
58
|
autoload :Configurable
|
52
59
|
autoload :Deprecation
|
60
|
+
autoload :Digest
|
53
61
|
autoload :Gzip
|
54
62
|
autoload :Inflector
|
55
63
|
autoload :JSON
|
@@ -62,6 +70,7 @@ module ActiveSupport
|
|
62
70
|
autoload :OrderedHash
|
63
71
|
autoload :OrderedOptions
|
64
72
|
autoload :StringInquirer
|
73
|
+
autoload :EnvironmentInquirer
|
65
74
|
autoload :TaggedLogging
|
66
75
|
autoload :XmlMini
|
67
76
|
autoload :ArrayInquirer
|
@@ -79,18 +88,6 @@ module ActiveSupport
|
|
79
88
|
|
80
89
|
cattr_accessor :test_order # :nodoc:
|
81
90
|
|
82
|
-
def self.halt_callback_chains_on_return_false
|
83
|
-
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
84
|
-
ActiveSupport.halt_callback_chains_on_return_false is deprecated and will be removed in Rails 5.2.
|
85
|
-
MSG
|
86
|
-
end
|
87
|
-
|
88
|
-
def self.halt_callback_chains_on_return_false=(value)
|
89
|
-
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
90
|
-
ActiveSupport.halt_callback_chains_on_return_false= is deprecated and will be removed in Rails 5.2.
|
91
|
-
MSG
|
92
|
-
end
|
93
|
-
|
94
91
|
def self.to_time_preserves_timezone
|
95
92
|
DateAndTime::Compatibility.preserve_timezone
|
96
93
|
end
|
@@ -98,6 +95,14 @@ module ActiveSupport
|
|
98
95
|
def self.to_time_preserves_timezone=(value)
|
99
96
|
DateAndTime::Compatibility.preserve_timezone = value
|
100
97
|
end
|
98
|
+
|
99
|
+
def self.utc_to_local_returns_utc_offset_times
|
100
|
+
DateAndTime::Compatibility.utc_to_local_returns_utc_offset_times
|
101
|
+
end
|
102
|
+
|
103
|
+
def self.utc_to_local_returns_utc_offset_times=(value)
|
104
|
+
DateAndTime::Compatibility.utc_to_local_returns_utc_offset_times = value
|
105
|
+
end
|
101
106
|
end
|
102
107
|
|
103
108
|
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
|
+
version: 6.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1.6'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '2'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '1.6'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '2'
|
@@ -36,48 +36,62 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
39
|
+
version: '2.0'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '
|
46
|
+
version: '2.0'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: concurrent-ruby
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: '
|
53
|
+
version: '1.0'
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 1.0.2
|
54
57
|
type: :runtime
|
55
58
|
prerelease: false
|
56
59
|
version_requirements: !ruby/object:Gem::Requirement
|
57
60
|
requirements:
|
58
61
|
- - "~>"
|
59
62
|
- !ruby/object:Gem::Version
|
60
|
-
version: '
|
63
|
+
version: '1.0'
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 1.0.2
|
61
67
|
- !ruby/object:Gem::Dependency
|
62
|
-
name:
|
68
|
+
name: zeitwerk
|
63
69
|
requirement: !ruby/object:Gem::Requirement
|
64
70
|
requirements:
|
65
71
|
- - "~>"
|
66
72
|
- !ruby/object:Gem::Version
|
67
|
-
version: '
|
68
|
-
- - ">="
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: 1.0.2
|
73
|
+
version: '2.3'
|
71
74
|
type: :runtime
|
72
75
|
prerelease: false
|
73
76
|
version_requirements: !ruby/object:Gem::Requirement
|
74
77
|
requirements:
|
75
78
|
- - "~>"
|
76
79
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
80
|
+
version: '2.3'
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: minitest
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
78
85
|
- - ">="
|
79
86
|
- !ruby/object:Gem::Version
|
80
|
-
version: 1
|
87
|
+
version: '5.1'
|
88
|
+
type: :runtime
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ">="
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '5.1'
|
81
95
|
description: A toolkit of support libraries and Ruby core extensions extracted from
|
82
96
|
the Rails framework. Rich support for multibyte strings, internationalization, time
|
83
97
|
zones, and testing.
|
@@ -90,6 +104,7 @@ files:
|
|
90
104
|
- MIT-LICENSE
|
91
105
|
- README.rdoc
|
92
106
|
- lib/active_support.rb
|
107
|
+
- lib/active_support/actionable_error.rb
|
93
108
|
- lib/active_support/all.rb
|
94
109
|
- lib/active_support/array_inquirer.rb
|
95
110
|
- lib/active_support/backtrace_cleaner.rb
|
@@ -100,6 +115,7 @@ files:
|
|
100
115
|
- lib/active_support/cache/mem_cache_store.rb
|
101
116
|
- lib/active_support/cache/memory_store.rb
|
102
117
|
- lib/active_support/cache/null_store.rb
|
118
|
+
- lib/active_support/cache/redis_cache_store.rb
|
103
119
|
- lib/active_support/cache/strategy/local_cache.rb
|
104
120
|
- lib/active_support/cache/strategy/local_cache_middleware.rb
|
105
121
|
- lib/active_support/callbacks.rb
|
@@ -107,14 +123,15 @@ files:
|
|
107
123
|
- lib/active_support/concurrency/load_interlock_aware_monitor.rb
|
108
124
|
- lib/active_support/concurrency/share_lock.rb
|
109
125
|
- lib/active_support/configurable.rb
|
126
|
+
- lib/active_support/configuration_file.rb
|
110
127
|
- lib/active_support/core_ext.rb
|
111
128
|
- lib/active_support/core_ext/array.rb
|
112
129
|
- lib/active_support/core_ext/array/access.rb
|
113
130
|
- lib/active_support/core_ext/array/conversions.rb
|
131
|
+
- lib/active_support/core_ext/array/extract.rb
|
114
132
|
- lib/active_support/core_ext/array/extract_options.rb
|
115
133
|
- lib/active_support/core_ext/array/grouping.rb
|
116
134
|
- lib/active_support/core_ext/array/inquiry.rb
|
117
|
-
- lib/active_support/core_ext/array/prepend_and_append.rb
|
118
135
|
- lib/active_support/core_ext/array/wrap.rb
|
119
136
|
- lib/active_support/core_ext/benchmark.rb
|
120
137
|
- lib/active_support/core_ext/big_decimal.rb
|
@@ -138,26 +155,25 @@ files:
|
|
138
155
|
- lib/active_support/core_ext/date_time/calculations.rb
|
139
156
|
- lib/active_support/core_ext/date_time/compatibility.rb
|
140
157
|
- lib/active_support/core_ext/date_time/conversions.rb
|
158
|
+
- lib/active_support/core_ext/digest.rb
|
141
159
|
- lib/active_support/core_ext/digest/uuid.rb
|
142
160
|
- lib/active_support/core_ext/enumerable.rb
|
143
161
|
- lib/active_support/core_ext/file.rb
|
144
162
|
- lib/active_support/core_ext/file/atomic.rb
|
145
163
|
- lib/active_support/core_ext/hash.rb
|
146
|
-
- lib/active_support/core_ext/hash/compact.rb
|
147
164
|
- lib/active_support/core_ext/hash/conversions.rb
|
148
165
|
- lib/active_support/core_ext/hash/deep_merge.rb
|
166
|
+
- lib/active_support/core_ext/hash/deep_transform_values.rb
|
149
167
|
- lib/active_support/core_ext/hash/except.rb
|
150
168
|
- lib/active_support/core_ext/hash/indifferent_access.rb
|
151
169
|
- lib/active_support/core_ext/hash/keys.rb
|
152
170
|
- lib/active_support/core_ext/hash/reverse_merge.rb
|
153
171
|
- lib/active_support/core_ext/hash/slice.rb
|
154
|
-
- lib/active_support/core_ext/hash/transform_values.rb
|
155
172
|
- lib/active_support/core_ext/integer.rb
|
156
173
|
- lib/active_support/core_ext/integer/inflections.rb
|
157
174
|
- lib/active_support/core_ext/integer/multiple.rb
|
158
175
|
- lib/active_support/core_ext/integer/time.rb
|
159
176
|
- lib/active_support/core_ext/kernel.rb
|
160
|
-
- lib/active_support/core_ext/kernel/agnostics.rb
|
161
177
|
- lib/active_support/core_ext/kernel/concern.rb
|
162
178
|
- lib/active_support/core_ext/kernel/reporting.rb
|
163
179
|
- lib/active_support/core_ext/kernel/singleton_class.rb
|
@@ -173,13 +189,12 @@ files:
|
|
173
189
|
- lib/active_support/core_ext/module/delegation.rb
|
174
190
|
- lib/active_support/core_ext/module/deprecation.rb
|
175
191
|
- lib/active_support/core_ext/module/introspection.rb
|
176
|
-
- lib/active_support/core_ext/module/
|
192
|
+
- lib/active_support/core_ext/module/redefine_method.rb
|
177
193
|
- lib/active_support/core_ext/module/remove_method.rb
|
178
194
|
- lib/active_support/core_ext/name_error.rb
|
179
195
|
- lib/active_support/core_ext/numeric.rb
|
180
196
|
- lib/active_support/core_ext/numeric/bytes.rb
|
181
197
|
- lib/active_support/core_ext/numeric/conversions.rb
|
182
|
-
- lib/active_support/core_ext/numeric/inquiry.rb
|
183
198
|
- lib/active_support/core_ext/numeric/time.rb
|
184
199
|
- lib/active_support/core_ext/object.rb
|
185
200
|
- lib/active_support/core_ext/object/acts_like.rb
|
@@ -195,9 +210,10 @@ files:
|
|
195
210
|
- lib/active_support/core_ext/object/try.rb
|
196
211
|
- lib/active_support/core_ext/object/with_options.rb
|
197
212
|
- lib/active_support/core_ext/range.rb
|
213
|
+
- lib/active_support/core_ext/range/compare_range.rb
|
198
214
|
- lib/active_support/core_ext/range/conversions.rb
|
199
215
|
- lib/active_support/core_ext/range/each.rb
|
200
|
-
- lib/active_support/core_ext/range/
|
216
|
+
- lib/active_support/core_ext/range/include_time_with_zone.rb
|
201
217
|
- lib/active_support/core_ext/range/overlaps.rb
|
202
218
|
- lib/active_support/core_ext/regexp.rb
|
203
219
|
- lib/active_support/core_ext/securerandom.rb
|
@@ -215,6 +231,8 @@ files:
|
|
215
231
|
- lib/active_support/core_ext/string/starts_ends_with.rb
|
216
232
|
- lib/active_support/core_ext/string/strip.rb
|
217
233
|
- lib/active_support/core_ext/string/zones.rb
|
234
|
+
- lib/active_support/core_ext/symbol.rb
|
235
|
+
- lib/active_support/core_ext/symbol/starts_ends_with.rb
|
218
236
|
- lib/active_support/core_ext/time.rb
|
219
237
|
- lib/active_support/core_ext/time/acts_like.rb
|
220
238
|
- lib/active_support/core_ext/time/calculations.rb
|
@@ -222,24 +240,33 @@ files:
|
|
222
240
|
- lib/active_support/core_ext/time/conversions.rb
|
223
241
|
- lib/active_support/core_ext/time/zones.rb
|
224
242
|
- lib/active_support/core_ext/uri.rb
|
243
|
+
- lib/active_support/current_attributes.rb
|
244
|
+
- lib/active_support/current_attributes/test_helper.rb
|
225
245
|
- lib/active_support/dependencies.rb
|
226
246
|
- lib/active_support/dependencies/autoload.rb
|
227
247
|
- lib/active_support/dependencies/interlock.rb
|
248
|
+
- lib/active_support/dependencies/zeitwerk_integration.rb
|
228
249
|
- lib/active_support/deprecation.rb
|
229
250
|
- lib/active_support/deprecation/behaviors.rb
|
230
251
|
- lib/active_support/deprecation/constant_accessor.rb
|
252
|
+
- lib/active_support/deprecation/disallowed.rb
|
231
253
|
- lib/active_support/deprecation/instance_delegator.rb
|
232
254
|
- lib/active_support/deprecation/method_wrappers.rb
|
233
255
|
- lib/active_support/deprecation/proxy_wrappers.rb
|
234
256
|
- lib/active_support/deprecation/reporting.rb
|
235
257
|
- lib/active_support/descendants_tracker.rb
|
258
|
+
- lib/active_support/digest.rb
|
236
259
|
- lib/active_support/duration.rb
|
237
260
|
- lib/active_support/duration/iso8601_parser.rb
|
238
261
|
- lib/active_support/duration/iso8601_serializer.rb
|
262
|
+
- lib/active_support/encrypted_configuration.rb
|
263
|
+
- lib/active_support/encrypted_file.rb
|
264
|
+
- lib/active_support/environment_inquirer.rb
|
239
265
|
- lib/active_support/evented_file_update_checker.rb
|
240
266
|
- lib/active_support/execution_wrapper.rb
|
241
267
|
- lib/active_support/executor.rb
|
242
268
|
- lib/active_support/file_update_checker.rb
|
269
|
+
- lib/active_support/fork_tracker.rb
|
243
270
|
- lib/active_support/gem_version.rb
|
244
271
|
- lib/active_support/gzip.rb
|
245
272
|
- lib/active_support/hash_with_indifferent_access.rb
|
@@ -255,6 +282,7 @@ files:
|
|
255
282
|
- lib/active_support/json/encoding.rb
|
256
283
|
- lib/active_support/key_generator.rb
|
257
284
|
- lib/active_support/lazy_load_hooks.rb
|
285
|
+
- lib/active_support/locale/en.rb
|
258
286
|
- lib/active_support/locale/en.yml
|
259
287
|
- lib/active_support/log_subscriber.rb
|
260
288
|
- lib/active_support/log_subscriber/test_helper.rb
|
@@ -263,6 +291,9 @@ files:
|
|
263
291
|
- lib/active_support/logger_thread_safe_level.rb
|
264
292
|
- lib/active_support/message_encryptor.rb
|
265
293
|
- lib/active_support/message_verifier.rb
|
294
|
+
- lib/active_support/messages/metadata.rb
|
295
|
+
- lib/active_support/messages/rotation_configuration.rb
|
296
|
+
- lib/active_support/messages/rotator.rb
|
266
297
|
- lib/active_support/multibyte.rb
|
267
298
|
- lib/active_support/multibyte/chars.rb
|
268
299
|
- lib/active_support/multibyte/unicode.rb
|
@@ -282,12 +313,14 @@ files:
|
|
282
313
|
- lib/active_support/option_merger.rb
|
283
314
|
- lib/active_support/ordered_hash.rb
|
284
315
|
- lib/active_support/ordered_options.rb
|
316
|
+
- lib/active_support/parameter_filter.rb
|
285
317
|
- lib/active_support/per_thread_registry.rb
|
286
318
|
- lib/active_support/proxy_object.rb
|
287
319
|
- lib/active_support/rails.rb
|
288
320
|
- lib/active_support/railtie.rb
|
289
321
|
- lib/active_support/reloader.rb
|
290
322
|
- lib/active_support/rescuable.rb
|
323
|
+
- lib/active_support/secure_compare_rotator.rb
|
291
324
|
- lib/active_support/security_utils.rb
|
292
325
|
- lib/active_support/string_inquirer.rb
|
293
326
|
- lib/active_support/subscriber.rb
|
@@ -301,6 +334,9 @@ files:
|
|
301
334
|
- lib/active_support/testing/file_fixtures.rb
|
302
335
|
- lib/active_support/testing/isolation.rb
|
303
336
|
- lib/active_support/testing/method_call_assertions.rb
|
337
|
+
- lib/active_support/testing/parallelization.rb
|
338
|
+
- lib/active_support/testing/parallelization/server.rb
|
339
|
+
- lib/active_support/testing/parallelization/worker.rb
|
304
340
|
- lib/active_support/testing/setup_and_teardown.rb
|
305
341
|
- lib/active_support/testing/stream.rb
|
306
342
|
- lib/active_support/testing/tagged_logging.rb
|
@@ -308,7 +344,6 @@ files:
|
|
308
344
|
- lib/active_support/time.rb
|
309
345
|
- lib/active_support/time_with_zone.rb
|
310
346
|
- lib/active_support/values/time_zone.rb
|
311
|
-
- lib/active_support/values/unicode_tables.dat
|
312
347
|
- lib/active_support/version.rb
|
313
348
|
- lib/active_support/xml_mini.rb
|
314
349
|
- lib/active_support/xml_mini/jdom.rb
|
@@ -317,13 +352,17 @@ files:
|
|
317
352
|
- lib/active_support/xml_mini/nokogiri.rb
|
318
353
|
- lib/active_support/xml_mini/nokogirisax.rb
|
319
354
|
- lib/active_support/xml_mini/rexml.rb
|
320
|
-
homepage:
|
355
|
+
homepage: https://rubyonrails.org
|
321
356
|
licenses:
|
322
357
|
- MIT
|
323
358
|
metadata:
|
324
|
-
|
325
|
-
changelog_uri: https://github.com/rails/rails/blob/
|
326
|
-
|
359
|
+
bug_tracker_uri: https://github.com/rails/rails/issues
|
360
|
+
changelog_uri: https://github.com/rails/rails/blob/v6.1.7/activesupport/CHANGELOG.md
|
361
|
+
documentation_uri: https://api.rubyonrails.org/v6.1.7/
|
362
|
+
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
363
|
+
source_code_uri: https://github.com/rails/rails/tree/v6.1.7/activesupport
|
364
|
+
rubygems_mfa_required: 'true'
|
365
|
+
post_install_message:
|
327
366
|
rdoc_options:
|
328
367
|
- "--encoding"
|
329
368
|
- UTF-8
|
@@ -333,15 +372,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
333
372
|
requirements:
|
334
373
|
- - ">="
|
335
374
|
- !ruby/object:Gem::Version
|
336
|
-
version: 2.
|
375
|
+
version: 2.5.0
|
337
376
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
338
377
|
requirements:
|
339
378
|
- - ">="
|
340
379
|
- !ruby/object:Gem::Version
|
341
380
|
version: '0'
|
342
381
|
requirements: []
|
343
|
-
rubygems_version: 3.
|
344
|
-
signing_key:
|
382
|
+
rubygems_version: 3.3.3
|
383
|
+
signing_key:
|
345
384
|
specification_version: 4
|
346
385
|
summary: A toolkit of support libraries and Ruby core extensions extracted from the
|
347
386
|
Rails framework.
|
@@ -1,27 +0,0 @@
|
|
1
|
-
class Hash
|
2
|
-
unless Hash.instance_methods(false).include?(:compact)
|
3
|
-
# Returns a hash with non +nil+ values.
|
4
|
-
#
|
5
|
-
# hash = { a: true, b: false, c: nil }
|
6
|
-
# hash.compact # => { a: true, b: false }
|
7
|
-
# hash # => { a: true, b: false, c: nil }
|
8
|
-
# { c: nil }.compact # => {}
|
9
|
-
# { c: true }.compact # => { c: true }
|
10
|
-
def compact
|
11
|
-
select { |_, value| !value.nil? }
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
unless Hash.instance_methods(false).include?(:compact!)
|
16
|
-
# Replaces current hash with non +nil+ values.
|
17
|
-
# Returns +nil+ if no changes were made, otherwise returns the hash.
|
18
|
-
#
|
19
|
-
# hash = { a: true, b: false, c: nil }
|
20
|
-
# hash.compact! # => { a: true, b: false }
|
21
|
-
# hash # => { a: true, b: false }
|
22
|
-
# { c: true }.compact! # => nil
|
23
|
-
def compact!
|
24
|
-
reject! { |_, value| value.nil? }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
class Hash
|
2
|
-
# Returns a new hash with the results of running +block+ once for every value.
|
3
|
-
# The keys are unchanged.
|
4
|
-
#
|
5
|
-
# { a: 1, b: 2, c: 3 }.transform_values { |x| x * 2 } # => { a: 2, b: 4, c: 6 }
|
6
|
-
#
|
7
|
-
# If you do not provide a +block+, it will return an Enumerator
|
8
|
-
# for chaining with other methods:
|
9
|
-
#
|
10
|
-
# { a: 1, b: 2 }.transform_values.with_index { |v, i| [v, i].join.to_i } # => { a: 10, b: 21 }
|
11
|
-
def transform_values
|
12
|
-
return enum_for(:transform_values) { size } unless block_given?
|
13
|
-
return {} if empty?
|
14
|
-
result = self.class.new
|
15
|
-
each do |key, value|
|
16
|
-
result[key] = yield(value)
|
17
|
-
end
|
18
|
-
result
|
19
|
-
end unless method_defined? :transform_values
|
20
|
-
|
21
|
-
# Destructively converts all values using the +block+ operations.
|
22
|
-
# Same as +transform_values+ but modifies +self+.
|
23
|
-
def transform_values!
|
24
|
-
return enum_for(:transform_values!) { size } unless block_given?
|
25
|
-
each do |key, value|
|
26
|
-
self[key] = yield(value)
|
27
|
-
end
|
28
|
-
end unless method_defined? :transform_values!
|
29
|
-
# TODO: Remove this file when supporting only Ruby 2.4+.
|
30
|
-
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,26 +0,0 @@
|
|
1
|
-
unless 1.respond_to?(:positive?) # TODO: Remove this file when we drop support to ruby < 2.3
|
2
|
-
class Numeric
|
3
|
-
# Returns true if the number is positive.
|
4
|
-
#
|
5
|
-
# 1.positive? # => true
|
6
|
-
# 0.positive? # => false
|
7
|
-
# -1.positive? # => false
|
8
|
-
def positive?
|
9
|
-
self > 0
|
10
|
-
end
|
11
|
-
|
12
|
-
# Returns true if the number is negative.
|
13
|
-
#
|
14
|
-
# -1.negative? # => true
|
15
|
-
# 0.negative? # => false
|
16
|
-
# 1.negative? # => false
|
17
|
-
def negative?
|
18
|
-
self < 0
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
class Complex
|
23
|
-
undef :positive?
|
24
|
-
undef :negative?
|
25
|
-
end
|
26
|
-
end
|
@@ -1,23 +0,0 @@
|
|
1
|
-
module ActiveSupport
|
2
|
-
module IncludeWithRange #:nodoc:
|
3
|
-
# Extends the default Range#include? to support range comparisons.
|
4
|
-
# (1..5).include?(1..5) # => true
|
5
|
-
# (1..5).include?(2..3) # => true
|
6
|
-
# (1..5).include?(2..6) # => false
|
7
|
-
#
|
8
|
-
# The native Range#include? behavior is untouched.
|
9
|
-
# ('a'..'f').include?('c') # => true
|
10
|
-
# (5..9).include?(11) # => false
|
11
|
-
def include?(value)
|
12
|
-
if value.is_a?(::Range)
|
13
|
-
# 1...10 includes 1..9 but it does not include 1..10.
|
14
|
-
operator = exclude_end? && !value.exclude_end? ? :< : :<=
|
15
|
-
super(value.first) && value.last.send(operator, last)
|
16
|
-
else
|
17
|
-
super
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
Range.prepend(ActiveSupport::IncludeWithRange)
|
Binary file
|