From af9fc474f23fe472115bcf3f566a40bb29d1478f Mon Sep 17 00:00:00 2001 From: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com> Date: Thu, 10 Dec 2020 06:38:17 +0000 Subject: [PATCH] brew vendor-gems: commit updates. --- .../Homebrew/vendor/bundle/bundler/setup.rb | 5 +- .../core_ext/array/prepend_and_append.rb | 5 - .../core_ext/class/subclasses.rb | 54 - .../core_ext/date_and_time/compatibility.rb | 16 - .../active_support/core_ext/hash/compact.rb | 5 - .../core_ext/hash/transform_values.rb | 5 - .../core_ext/module/reachable.rb | 6 - .../core_ext/numeric/inquiry.rb | 5 - .../core_ext/range/include_range.rb | 9 - .../lib/active_support/core_ext/regexp.rb | 7 - .../core_ext/string/starts_ends_with.rb | 6 - .../evented_file_update_checker.rb | 234 ---- .../lib/active_support/logger_silence.rb | 45 - .../logger_thread_safe_level.rb | 56 - .../lib/active_support/security_utils.rb | 31 - .../lib/active_support/actionable_error.rb | 0 .../lib/active_support/array_inquirer.rb | 6 +- .../lib/active_support/backtrace_cleaner.rb | 6 +- .../lib/active_support/benchmarkable.rb | 2 +- .../lib/active_support/builder.rb | 0 .../lib/active_support/callbacks.rb | 121 +- .../lib/active_support/concern.rb | 48 +- .../lib/active_support/configurable.rb | 6 +- .../lib/active_support/configuration_file.rb | 46 + .../lib/active_support/core_ext.rb | 0 .../lib/active_support/core_ext/array.rb | 0 .../active_support/core_ext/array/access.rb | 0 .../core_ext/array/conversions.rb | 0 .../active_support/core_ext/array/extract.rb | 0 .../core_ext/array/extract_options.rb | 0 .../active_support/core_ext/array/grouping.rb | 0 .../active_support/core_ext/array/inquiry.rb | 0 .../lib/active_support/core_ext/array/wrap.rb | 0 .../lib/active_support/core_ext/benchmark.rb | 4 +- .../active_support/core_ext/big_decimal.rb | 0 .../core_ext/big_decimal/conversions.rb | 0 .../lib/active_support/core_ext/class.rb | 0 .../core_ext/class/attribute.rb | 82 +- .../core_ext/class/attribute_accessors.rb | 0 .../core_ext/class/subclasses.rb | 33 + .../lib/active_support/core_ext/date.rb | 0 .../active_support/core_ext/date/acts_like.rb | 0 .../lib/active_support/core_ext/date/blank.rb | 0 .../core_ext/date/calculations.rb | 0 .../core_ext/date/conversions.rb | 3 +- .../lib/active_support/core_ext/date/zones.rb | 0 .../core_ext/date_and_time/calculations.rb | 13 + .../core_ext/date_and_time/compatibility.rb | 31 + .../core_ext/date_and_time/zones.rb | 0 .../lib/active_support/core_ext/date_time.rb | 0 .../core_ext/date_time/acts_like.rb | 0 .../core_ext/date_time/blank.rb | 0 .../core_ext/date_time/calculations.rb | 0 .../core_ext/date_time/compatibility.rb | 0 .../core_ext/date_time/conversions.rb | 0 .../lib/active_support/core_ext/digest.rb | 0 .../active_support/core_ext/digest/uuid.rb | 0 .../lib/active_support/core_ext/enumerable.rb | 80 +- .../lib/active_support/core_ext/file.rb | 0 .../active_support/core_ext/file/atomic.rb | 0 .../lib/active_support/core_ext/hash.rb | 0 .../core_ext/hash/conversions.rb | 4 +- .../core_ext/hash/deep_merge.rb | 0 .../core_ext/hash/deep_transform_values.rb | 2 +- .../active_support/core_ext/hash/except.rb | 2 +- .../core_ext/hash/indifferent_access.rb | 0 .../lib/active_support/core_ext/hash/keys.rb | 2 +- .../core_ext/hash/reverse_merge.rb | 0 .../lib/active_support/core_ext/hash/slice.rb | 5 +- .../lib/active_support/core_ext/integer.rb | 0 .../core_ext/integer/inflections.rb | 0 .../core_ext/integer/multiple.rb | 0 .../active_support/core_ext/integer/time.rb | 0 .../lib/active_support/core_ext/kernel.rb | 0 .../active_support/core_ext/kernel/concern.rb | 0 .../core_ext/kernel/reporting.rb | 0 .../core_ext/kernel/singleton_class.rb | 0 .../lib/active_support/core_ext/load_error.rb | 2 +- .../lib/active_support/core_ext/marshal.rb | 2 + .../lib/active_support/core_ext/module.rb | 0 .../core_ext/module/aliasing.rb | 0 .../core_ext/module/anonymous.rb | 0 .../core_ext/module/attr_internal.rb | 4 +- .../core_ext/module/attribute_accessors.rb | 52 +- .../module/attribute_accessors_per_thread.rb | 12 +- .../core_ext/module/concerning.rb | 10 +- .../core_ext/module/delegation.rb | 68 +- .../core_ext/module/deprecation.rb | 0 .../core_ext/module/introspection.rb | 26 +- .../core_ext/module/redefine_method.rb | 0 .../core_ext/module/remove_method.rb | 0 .../lib/active_support/core_ext/name_error.rb | 31 +- .../lib/active_support/core_ext/numeric.rb | 0 .../active_support/core_ext/numeric/bytes.rb | 0 .../core_ext/numeric/conversions.rb | 40 +- .../active_support/core_ext/numeric/time.rb | 0 .../lib/active_support/core_ext/object.rb | 0 .../core_ext/object/acts_like.rb | 0 .../active_support/core_ext/object/blank.rb | 0 .../core_ext/object/conversions.rb | 0 .../core_ext/object/deep_dup.rb | 2 +- .../core_ext/object/duplicable.rb | 0 .../core_ext/object/inclusion.rb | 0 .../core_ext/object/instance_variables.rb | 0 .../active_support/core_ext/object/json.rb | 8 +- .../core_ext/object/to_param.rb | 0 .../core_ext/object/to_query.rb | 0 .../lib/active_support/core_ext/object/try.rb | 4 +- .../core_ext/object/with_options.rb | 0 .../lib/active_support/core_ext/range.rb | 0 .../core_ext/range/compare_range.rb | 12 +- .../core_ext/range/conversions.rb | 0 .../lib/active_support/core_ext/range/each.rb | 0 .../core_ext/range/include_time_with_zone.rb | 11 +- .../active_support/core_ext/range/overlaps.rb | 0 .../lib/active_support/core_ext/regexp.rb | 14 + .../active_support/core_ext/securerandom.rb | 0 .../lib/active_support/core_ext/string.rb | 0 .../active_support/core_ext/string/access.rb | 29 +- .../core_ext/string/behavior.rb | 0 .../core_ext/string/conversions.rb | 1 + .../active_support/core_ext/string/exclude.rb | 0 .../active_support/core_ext/string/filters.rb | 0 .../active_support/core_ext/string/indent.rb | 0 .../core_ext/string/inflections.rb | 42 +- .../active_support/core_ext/string/inquiry.rb | 1 + .../core_ext/string/multibyte.rb | 4 +- .../core_ext/string/output_safety.rb | 18 +- .../core_ext/string/starts_ends_with.rb | 6 + .../active_support/core_ext/string/strip.rb | 0 .../active_support/core_ext/string/zones.rb | 0 .../lib/active_support/core_ext/symbol.rb | 3 + .../core_ext/symbol/starts_ends_with.rb | 14 + .../lib/active_support/core_ext/time.rb | 0 .../active_support/core_ext/time/acts_like.rb | 0 .../core_ext/time/calculations.rb | 20 +- .../core_ext/time/compatibility.rb | 0 .../core_ext/time/conversions.rb | 1 + .../lib/active_support/core_ext/time/zones.rb | 0 .../lib/active_support/core_ext/uri.rb | 6 +- .../lib/active_support/current_attributes.rb | 9 +- .../current_attributes/test_helper.rb | 13 + .../lib/active_support/deprecation.rb | 7 +- .../active_support/deprecation/behaviors.rb | 17 +- .../deprecation/constant_accessor.rb | 0 .../active_support/deprecation/disallowed.rb | 56 + .../deprecation/instance_delegator.rb | 1 - .../deprecation/method_wrappers.rb | 5 +- .../deprecation/proxy_wrappers.rb | 6 +- .../active_support/deprecation/reporting.rb | 57 +- .../lib/active_support/descendants_tracker.rb | 8 +- .../lib/active_support/digest.rb | 0 .../lib/active_support/duration.rb | 93 +- .../active_support/encrypted_configuration.rb | 0 .../lib/active_support/encrypted_file.rb | 21 +- .../active_support/environment_inquirer.rb | 20 + .../evented_file_update_checker.rb | 170 +++ .../lib/active_support/execution_wrapper.rb | 0 .../lib/active_support/executor.rb | 0 .../lib/active_support/file_update_checker.rb | 0 .../lib/active_support/fork_tracker.rb | 62 + .../lib/active_support/gem_version.rb | 6 +- .../lib/active_support/gzip.rb | 0 .../hash_with_indifferent_access.rb | 65 +- .../lib/active_support/i18n.rb | 0 .../lib/active_support/i18n_railtie.rb | 33 +- .../lib/active_support/inflections.rb | 0 .../lib/active_support/inflector.rb | 0 .../active_support/inflector/inflections.rb | 3 +- .../lib/active_support/inflector/methods.rb | 58 +- .../active_support/inflector/transliterate.rb | 8 +- .../lib/active_support/key_generator.rb | 2 +- .../lib/active_support/lazy_load_hooks.rb | 0 .../lib/active_support/locale/en.rb | 0 .../lib/active_support/locale/en.yml | 10 +- .../lib/active_support/logger.rb | 2 +- .../lib/active_support/logger_silence.rb | 21 + .../logger_thread_safe_level.rb | 78 ++ .../lib/active_support/message_encryptor.rb | 11 +- .../lib/active_support/message_verifier.rb | 10 +- .../lib/active_support/multibyte.rb | 0 .../lib/active_support/notifications.rb | 35 +- .../active_support/notifications/fanout.rb | 31 +- .../notifications/instrumenter.rb | 21 +- .../lib/active_support/option_merger.rb | 5 +- .../lib/active_support/ordered_hash.rb | 0 .../lib/active_support/ordered_options.rb | 10 +- .../lib/active_support/parameter_filter.rb | 25 +- .../lib/active_support/per_thread_registry.rb | 2 +- .../lib/active_support/proxy_object.rb | 0 .../lib/active_support/rails.rb | 5 +- .../lib/active_support/railtie.rb | 24 +- .../lib/active_support/reloader.rb | 0 .../lib/active_support/rescuable.rb | 0 .../active_support/secure_compare_rotator.rb | 51 + .../lib/active_support/security_utils.rb | 38 + .../lib/active_support/string_inquirer.rb | 6 +- .../lib/active_support/subscriber.rb | 19 +- .../lib/active_support/tagged_logging.rb | 33 +- .../lib/active_support/test_case.rb | 0 .../lib/active_support/time.rb | 0 .../lib/active_support/time_with_zone.rb | 108 +- .../lib/active_support/values/time_zone.rb | 30 +- .../lib/active_support/version.rb | 0 .../lib/active_support/xml_mini.rb | 0 .../lib/active_support/xml_mini/jdom.rb | 0 .../lib/active_support/xml_mini/libxml.rb | 0 .../lib/active_support/xml_mini/libxmlsax.rb | 0 .../lib/active_support/xml_mini/nokogiri.rb | 0 .../active_support/xml_mini/nokogirisax.rb | 0 .../lib/active_support/xml_mini/rexml.rb | 9 +- .../gems/thread_safe-0.3.6/lib/thread_safe.rb | 65 - .../atomic_reference_cache_backend.rb | 908 ------------- .../lib/thread_safe/cache.rb | 161 --- .../lib/thread_safe/mri_cache_backend.rb | 60 - .../non_concurrent_cache_backend.rb | 135 -- .../thread_safe/synchronized_cache_backend.rb | 77 -- .../lib/thread_safe/synchronized_delegator.rb | 43 - .../thread_safe-0.3.6/lib/thread_safe/util.rb | 16 - .../lib/thread_safe/version.rb | 21 - .../2.6.0/gems/tzinfo-1.2.8/lib/tzinfo.rb | 43 - .../tzinfo-1.2.8/lib/tzinfo/annual_rules.rb | 51 - .../gems/tzinfo-1.2.8/lib/tzinfo/country.rb | 196 --- .../lib/tzinfo/country_index_definition.rb | 31 - .../tzinfo-1.2.8/lib/tzinfo/country_info.rb | 42 - .../lib/tzinfo/country_timezone.rb | 135 -- .../tzinfo-1.2.8/lib/tzinfo/data_source.rb | 190 --- .../tzinfo-1.2.8/lib/tzinfo/data_timezone.rb | 58 - .../lib/tzinfo/data_timezone_info.rb | 55 - .../tzinfo-1.2.8/lib/tzinfo/info_timezone.rb | 30 - .../lib/tzinfo/linked_timezone.rb | 63 - .../lib/tzinfo/linked_timezone_info.rb | 26 - .../lib/tzinfo/offset_rationals.rb | 77 -- .../lib/tzinfo/posix_time_zone_parser.rb | 136 -- .../lib/tzinfo/ruby_core_support.rb | 169 --- .../lib/tzinfo/ruby_country_info.rb | 74 -- .../lib/tzinfo/ruby_data_source.rb | 140 -- .../lib/tzinfo/time_or_datetime.rb | 351 ----- .../gems/tzinfo-1.2.8/lib/tzinfo/timezone.rb | 673 ---------- .../lib/tzinfo/timezone_definition.rb | 36 - .../lib/tzinfo/timezone_index_definition.rb | 54 - .../tzinfo-1.2.8/lib/tzinfo/timezone_info.rb | 30 - .../lib/tzinfo/timezone_offset.rb | 101 -- .../lib/tzinfo/timezone_period.rb | 245 ---- .../tzinfo-1.2.8/lib/tzinfo/timezone_proxy.rb | 105 -- .../lib/tzinfo/timezone_transition.rb | 130 -- .../tzinfo/timezone_transition_definition.rb | 104 -- .../tzinfo/transition_data_timezone_info.rb | 274 ---- .../lib/tzinfo/transition_rule.rb | 325 ----- .../lib/tzinfo/zoneinfo_country_info.rb | 37 - .../lib/tzinfo/zoneinfo_data_source.rb | 497 ------- .../lib/tzinfo/zoneinfo_timezone_info.rb | 515 -------- .../2.6.0/gems/tzinfo-2.0.3/lib/tzinfo.rb | 73 ++ .../tzinfo-2.0.3/lib/tzinfo/annual_rules.rb | 71 + .../gems/tzinfo-2.0.3/lib/tzinfo/country.rb | 208 +++ .../lib/tzinfo/country_timezone.rb | 93 ++ .../tzinfo-2.0.3/lib/tzinfo/data_source.rb | 435 +++++++ .../tzinfo-2.0.3/lib/tzinfo/data_sources.rb | 8 + .../constant_offset_data_timezone_info.rb | 56 + .../lib/tzinfo/data_sources/country_info.rb | 42 + .../tzinfo/data_sources/data_timezone_info.rb | 91 ++ .../data_sources/linked_timezone_info.rb | 33 + .../data_sources/posix_time_zone_parser.rb | 181 +++ .../tzinfo/data_sources/ruby_data_source.rb | 145 +++ .../lib/tzinfo/data_sources/timezone_info.rb | 47 + .../transitions_data_timezone_info.rb | 214 +++ .../data_sources/zoneinfo_data_source.rb | 580 +++++++++ .../tzinfo/data_sources/zoneinfo_reader.rb | 483 +++++++ .../tzinfo-2.0.3/lib/tzinfo/data_timezone.rb | 44 + .../lib/tzinfo/datetime_with_offset.rb | 153 +++ .../gems/tzinfo-2.0.3/lib/tzinfo/format1.rb | 10 + .../lib/tzinfo/format1/country_definer.rb | 17 + .../format1/country_index_definition.rb | 64 + .../lib/tzinfo/format1/timezone_definer.rb | 64 + .../lib/tzinfo/format1/timezone_definition.rb | 39 + .../format1/timezone_index_definition.rb | 77 ++ .../gems/tzinfo-2.0.3/lib/tzinfo/format2.rb | 10 + .../lib/tzinfo/format2/country_definer.rb | 68 + .../tzinfo/format2/country_index_definer.rb | 68 + .../format2/country_index_definition.rb | 46 + .../lib/tzinfo/format2/timezone_definer.rb | 94 ++ .../lib/tzinfo/format2/timezone_definition.rb | 73 ++ .../tzinfo/format2/timezone_index_definer.rb | 45 + .../format2/timezone_index_definition.rb | 55 + .../tzinfo-2.0.3/lib/tzinfo/info_timezone.rb | 35 + .../lib/tzinfo/linked_timezone.rb | 44 + .../lib/tzinfo/offset_timezone_period.rb | 42 + .../tzinfo-2.0.3/lib/tzinfo/string_deduper.rb | 118 ++ .../lib/tzinfo/time_with_offset.rb | 154 +++ .../gems/tzinfo-2.0.3/lib/tzinfo/timestamp.rb | 548 ++++++++ .../lib/tzinfo/timestamp_with_offset.rb | 85 ++ .../gems/tzinfo-2.0.3/lib/tzinfo/timezone.rb | 1160 +++++++++++++++++ .../lib/tzinfo/timezone_offset.rb | 111 ++ .../lib/tzinfo/timezone_period.rb | 179 +++ .../tzinfo-2.0.3/lib/tzinfo/timezone_proxy.rb | 96 ++ .../lib/tzinfo/timezone_transition.rb | 98 ++ .../lib/tzinfo/transition_rule.rb | 455 +++++++ .../lib/tzinfo/transitions_timezone_period.rb | 63 + .../tzinfo-2.0.3/lib/tzinfo/untaint_ext.rb | 18 + .../gems/tzinfo-2.0.3/lib/tzinfo/version.rb | 7 + .../tzinfo-2.0.3/lib/tzinfo/with_offset.rb | 61 + 301 files changed, 8663 insertions(+), 7509 deletions(-) delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array/prepend_and_append.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/class/subclasses.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_and_time/compatibility.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/compact.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/transform_values.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/reachable.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/numeric/inquiry.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/range/include_range.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/regexp.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/starts_ends_with.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/evented_file_update_checker.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/logger_silence.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/logger_thread_safe_level.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/security_utils.rb rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/actionable_error.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/array_inquirer.rb (91%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/backtrace_cleaner.rb (94%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/benchmarkable.rb (96%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/builder.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/callbacks.rb (91%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/concern.rb (73%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/configurable.rb (97%) create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/configuration_file.rb rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/array.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/array/access.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/array/conversions.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/array/extract.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/array/extract_options.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/array/grouping.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/array/inquiry.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/array/wrap.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/benchmark.rb (83%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/big_decimal.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/big_decimal/conversions.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/class.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/class/attribute.rb (68%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/class/attribute_accessors.rb (100%) create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/class/subclasses.rb rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/date.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/date/acts_like.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/date/blank.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/date/calculations.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/date/conversions.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/date/zones.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/date_and_time/calculations.rb (96%) create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_and_time/compatibility.rb rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/date_and_time/zones.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/date_time.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/date_time/acts_like.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/date_time/blank.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/date_time/calculations.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/date_time/compatibility.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/date_time/conversions.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/digest.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/digest/uuid.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/enumerable.rb (67%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/file.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/file/atomic.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/hash.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/hash/conversions.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/hash/deep_merge.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/hash/deep_transform_values.rb (95%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/hash/except.rb (95%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/hash/indifferent_access.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/hash/keys.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/hash/reverse_merge.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/hash/slice.rb (83%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/integer.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/integer/inflections.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/integer/multiple.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/integer/time.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/kernel.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/kernel/concern.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/kernel/reporting.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/kernel/singleton_class.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/load_error.rb (77%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/marshal.rb (92%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/module.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/module/aliasing.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/module/anonymous.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/module/attr_internal.rb (90%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/module/attribute_accessors.rb (83%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb (93%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/module/concerning.rb (91%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/module/delegation.rb (85%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/module/deprecation.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/module/introspection.rb (67%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/module/redefine_method.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/module/remove_method.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/name_error.rb (54%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/numeric.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/numeric/bytes.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/numeric/conversions.rb (76%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/numeric/time.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/object.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/object/acts_like.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/object/blank.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/object/conversions.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/object/deep_dup.rb (94%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/object/duplicable.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/object/inclusion.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/object/instance_variables.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/object/json.rb (95%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/object/to_param.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/object/to_query.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/object/try.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/object/with_options.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/range.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/range/compare_range.rb (77%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/range/conversions.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/range/each.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/range/include_time_with_zone.rb (50%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/range/overlaps.rb (100%) create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/regexp.rb rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/securerandom.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/string.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/string/access.rb (83%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/string/behavior.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/string/conversions.rb (96%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/string/exclude.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/string/filters.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/string/indent.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/string/inflections.rb (91%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/string/inquiry.rb (89%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/string/multibyte.rb (96%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/string/output_safety.rb (95%) create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/starts_ends_with.rb rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/string/strip.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/string/zones.rb (100%) create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/symbol.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/symbol/starts_ends_with.rb rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/time.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/time/acts_like.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/time/calculations.rb (95%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/time/compatibility.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/time/conversions.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/time/zones.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/core_ext/uri.rb (76%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/current_attributes.rb (96%) create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/current_attributes/test_helper.rb rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/deprecation.rb (84%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/deprecation/behaviors.rb (84%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/deprecation/constant_accessor.rb (100%) create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/disallowed.rb rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/deprecation/instance_delegator.rb (94%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/deprecation/method_wrappers.rb (94%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/deprecation/proxy_wrappers.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/deprecation/reporting.rb (64%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/descendants_tracker.rb (93%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/digest.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/duration.rb (81%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/encrypted_configuration.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/encrypted_file.rb (76%) create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/environment_inquirer.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/evented_file_update_checker.rb rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/execution_wrapper.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/executor.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/file_update_checker.rb (100%) create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/fork_tracker.rb rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/gem_version.rb (87%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/gzip.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/hash_with_indifferent_access.rb (86%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/i18n.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/i18n_railtie.rb (80%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/inflections.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/inflector.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/inflector/inflections.rb (98%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/inflector/methods.rb (90%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/inflector/transliterate.rb (94%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/key_generator.rb (95%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/lazy_load_hooks.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/locale/en.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/locale/en.yml (92%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/logger.rb (97%) create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/logger_silence.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/logger_thread_safe_level.rb rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/message_encryptor.rb (95%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/message_verifier.rb (97%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/multibyte.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/notifications.rb (85%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/notifications/fanout.rb (87%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/notifications/instrumenter.rb (88%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/option_merger.rb (85%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/ordered_hash.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/ordered_options.rb (87%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/parameter_filter.rb (87%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/per_thread_registry.rb (95%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/proxy_object.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/rails.rb (88%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/railtie.rb (74%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/reloader.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/rescuable.rb (100%) create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/secure_compare_rotator.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/security_utils.rb rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/string_inquirer.rb (84%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/subscriber.rb (88%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/tagged_logging.rb (71%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/test_case.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/time.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/time_with_zone.rb (86%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/values/time_zone.rb (95%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/version.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/xml_mini.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/xml_mini/jdom.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/xml_mini/libxml.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/xml_mini/libxmlsax.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/xml_mini/nokogiri.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/xml_mini/nokogirisax.rb (100%) rename Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/{activesupport-6.0.3.4 => activesupport-6.1.0}/lib/active_support/xml_mini/rexml.rb (92%) delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/atomic_reference_cache_backend.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/cache.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/mri_cache_backend.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/non_concurrent_cache_backend.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/synchronized_cache_backend.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/synchronized_delegator.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/util.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/version.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/annual_rules.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/country.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/country_index_definition.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/country_info.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/country_timezone.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/data_source.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/data_timezone.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/data_timezone_info.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/info_timezone.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/linked_timezone.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/linked_timezone_info.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/offset_rationals.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/posix_time_zone_parser.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/ruby_core_support.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/ruby_country_info.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/ruby_data_source.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/time_or_datetime.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_definition.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_index_definition.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_info.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_offset.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_period.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_proxy.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_transition.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_transition_definition.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/transition_data_timezone_info.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/transition_rule.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/zoneinfo_country_info.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/zoneinfo_data_source.rb delete mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/zoneinfo_timezone_info.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/annual_rules.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/country.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/country_timezone.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_source.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/constant_offset_data_timezone_info.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/country_info.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/data_timezone_info.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/linked_timezone_info.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/posix_time_zone_parser.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/ruby_data_source.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/timezone_info.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/transitions_data_timezone_info.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/zoneinfo_data_source.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/zoneinfo_reader.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_timezone.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/datetime_with_offset.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1/country_definer.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1/country_index_definition.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1/timezone_definer.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1/timezone_definition.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1/timezone_index_definition.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/country_definer.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/country_index_definer.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/country_index_definition.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/timezone_definer.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/timezone_definition.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/timezone_index_definer.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/timezone_index_definition.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/info_timezone.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/linked_timezone.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/offset_timezone_period.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/string_deduper.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/time_with_offset.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timestamp.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timestamp_with_offset.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timezone.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timezone_offset.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timezone_period.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timezone_proxy.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timezone_transition.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/transition_rule.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/transitions_timezone_period.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/untaint_ext.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/version.rb create mode 100644 Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/with_offset.rb diff --git a/Library/Homebrew/vendor/bundle/bundler/setup.rb b/Library/Homebrew/vendor/bundle/bundler/setup.rb index e15f1f6fdb..9729c84b5b 100644 --- a/Library/Homebrew/vendor/bundle/bundler/setup.rb +++ b/Library/Homebrew/vendor/bundle/bundler/setup.rb @@ -6,10 +6,9 @@ path = File.expand_path('..', __FILE__) $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/concurrent-ruby-1.1.7/lib/concurrent-ruby" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.8.5/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.14.2/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/thread_safe-0.3.6/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-1.2.8/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-2.0.3/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/zeitwerk-2.4.2/lib" -$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.0.3.4/lib" +$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.1.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/ast-2.4.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/bindata-2.4.8/lib" $:.unshift "#{path}/" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array/prepend_and_append.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array/prepend_and_append.rb deleted file mode 100644 index ba3739f640..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array/prepend_and_append.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -require "active_support/deprecation" - -ActiveSupport::Deprecation.warn "Ruby 2.5+ (required by Rails 6) provides Array#append and Array#prepend natively, so requiring active_support/core_ext/array/prepend_and_append is no longer necessary. Requiring it will raise LoadError in Rails 6.1." diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/class/subclasses.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/class/subclasses.rb deleted file mode 100644 index 56fb46a88d..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/class/subclasses.rb +++ /dev/null @@ -1,54 +0,0 @@ -# frozen_string_literal: true - -class Class - begin - # Test if this Ruby supports each_object against singleton_class - ObjectSpace.each_object(Numeric.singleton_class) { } - - # Returns an array with all classes that are < than its receiver. - # - # class C; end - # C.descendants # => [] - # - # class B < C; end - # C.descendants # => [B] - # - # class A < B; end - # C.descendants # => [B, A] - # - # class D < C; end - # C.descendants # => [B, A, D] - def descendants - descendants = [] - ObjectSpace.each_object(singleton_class) do |k| - next if k.singleton_class? - descendants.unshift k unless k == self - end - descendants - end - rescue StandardError # JRuby 9.0.4.0 and earlier - def descendants - descendants = [] - ObjectSpace.each_object(Class) do |k| - descendants.unshift k if k < self - end - descendants.uniq! - descendants - end - end - - # Returns an array with the direct children of +self+. - # - # class Foo; end - # class Bar < Foo; end - # class Baz < Bar; end - # - # Foo.subclasses # => [Bar] - def subclasses - subclasses, chain = [], descendants - chain.each do |k| - subclasses << k unless chain.any? { |c| c > k } - end - subclasses - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_and_time/compatibility.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_and_time/compatibility.rb deleted file mode 100644 index d33c36ef73..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_and_time/compatibility.rb +++ /dev/null @@ -1,16 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/module/attribute_accessors" - -module DateAndTime - module Compatibility - # If true, +to_time+ preserves the timezone offset of receiver. - # - # NOTE: With Ruby 2.4+ the default for +to_time+ changed from - # converting to the local system time, to preserving the offset - # of the receiver. For backwards compatibility we're overriding - # this behavior, but new apps will have an initializer that sets - # this to true, because the new behavior is preferred. - mattr_accessor :preserve_timezone, instance_writer: false, default: false - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/compact.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/compact.rb deleted file mode 100644 index 5cb858af5c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/compact.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -require "active_support/deprecation" - -ActiveSupport::Deprecation.warn "Ruby 2.5+ (required by Rails 6) provides Hash#compact and Hash#compact! natively, so requiring active_support/core_ext/hash/compact is no longer necessary. Requiring it will raise LoadError in Rails 6.1." diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/transform_values.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/transform_values.rb deleted file mode 100644 index e4aeb0e891..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/transform_values.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -require "active_support/deprecation" - -ActiveSupport::Deprecation.warn "Ruby 2.5+ (required by Rails 6) provides Hash#transform_values natively, so requiring active_support/core_ext/hash/transform_values is no longer necessary. Requiring it will raise LoadError in Rails 6.1." diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/reachable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/reachable.rb deleted file mode 100644 index 2020f5204c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/reachable.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -require "active_support/core_ext/module/anonymous" -require "active_support/core_ext/string/inflections" - -ActiveSupport::Deprecation.warn("reachable is deprecated and will be removed from the framework.") diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/numeric/inquiry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/numeric/inquiry.rb deleted file mode 100644 index 6b5240d051..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/numeric/inquiry.rb +++ /dev/null @@ -1,5 +0,0 @@ -# frozen_string_literal: true - -require "active_support/deprecation" - -ActiveSupport::Deprecation.warn "Ruby 2.5+ (required by Rails 6) provides Numeric#positive? and Numeric#negative? natively, so requiring active_support/core_ext/numeric/inquiry is no longer necessary. Requiring it will raise LoadError in Rails 6.1." diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/range/include_range.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/range/include_range.rb deleted file mode 100644 index 2da2c587a3..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/range/include_range.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -require "active_support/deprecation" - -ActiveSupport::Deprecation.warn "You have required `active_support/core_ext/range/include_range`. " \ -"This file will be removed in Rails 6.1. You should require `active_support/core_ext/range/compare_range` " \ - "instead." - -require "active_support/core_ext/range/compare_range" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/regexp.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/regexp.rb deleted file mode 100644 index d92943c7ae..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/regexp.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -class Regexp #:nodoc: - def multiline? - options & MULTILINE == MULTILINE - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/starts_ends_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/starts_ends_with.rb deleted file mode 100644 index 919eb7a573..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/starts_ends_with.rb +++ /dev/null @@ -1,6 +0,0 @@ -# frozen_string_literal: true - -class String - alias_method :starts_with?, :start_with? - alias_method :ends_with?, :end_with? -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/evented_file_update_checker.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/evented_file_update_checker.rb deleted file mode 100644 index 9cbe1ed973..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/evented_file_update_checker.rb +++ /dev/null @@ -1,234 +0,0 @@ -# frozen_string_literal: true - -require "set" -require "pathname" -require "concurrent/atomic/atomic_boolean" - -module ActiveSupport - # Allows you to "listen" to changes in a file system. - # The evented file updater does not hit disk when checking for updates - # instead it uses platform specific file system events to trigger a change - # in state. - # - # The file checker takes an array of files to watch or a hash specifying directories - # and file extensions to watch. It also takes a block that is called when - # EventedFileUpdateChecker#execute is run or when EventedFileUpdateChecker#execute_if_updated - # is run and there have been changes to the file system. - # - # Note: Forking will cause the first call to `updated?` to return `true`. - # - # Example: - # - # checker = ActiveSupport::EventedFileUpdateChecker.new(["/tmp/foo"]) { puts "changed" } - # checker.updated? - # # => false - # checker.execute_if_updated - # # => nil - # - # FileUtils.touch("/tmp/foo") - # - # checker.updated? - # # => true - # checker.execute_if_updated - # # => "changed" - # - class EventedFileUpdateChecker #:nodoc: all - def initialize(files, dirs = {}, &block) - unless block - raise ArgumentError, "A block is required to initialize an EventedFileUpdateChecker" - end - - @ph = PathHelper.new - @files = files.map { |f| @ph.xpath(f) }.to_set - - @dirs = {} - dirs.each do |dir, exts| - @dirs[@ph.xpath(dir)] = Array(exts).map { |ext| @ph.normalize_extension(ext) } - end - - @block = block - @updated = Concurrent::AtomicBoolean.new(false) - @lcsp = @ph.longest_common_subpath(@dirs.keys) - @pid = Process.pid - @boot_mutex = Mutex.new - - dtw = directories_to_watch - @dtw, @missing = dtw.partition(&:exist?) - - if @dtw.any? - # Loading listen triggers warnings. These are originated by a legit - # usage of attr_* macros for private attributes, but adds a lot of noise - # to our test suite. Thus, we lazy load it and disable warnings locally. - silence_warnings do - require "listen" - rescue LoadError => e - raise LoadError, "Could not load the 'listen' gem. Add `gem 'listen'` to the development group of your Gemfile", e.backtrace - end - end - boot! - end - - def updated? - @boot_mutex.synchronize do - if @pid != Process.pid - boot! - @pid = Process.pid - @updated.make_true - end - end - - if @missing.any?(&:exist?) - @boot_mutex.synchronize do - appeared, @missing = @missing.partition(&:exist?) - shutdown! - - @dtw += appeared - boot! - - @updated.make_true - end - end - - @updated.true? - end - - def execute - @updated.make_false - @block.call - end - - def execute_if_updated - if updated? - yield if block_given? - execute - true - end - end - - private - def boot! - normalize_dirs! - - unless @dtw.empty? - Listen.to(*@dtw, &method(:changed)).start - end - end - - def shutdown! - Listen.stop - end - - def normalize_dirs! - @dirs.transform_keys! do |dir| - dir.exist? ? dir.realpath : dir - end - end - - def changed(modified, added, removed) - unless updated? - @updated.make_true if (modified + added + removed).any? { |f| watching?(f) } - end - end - - def watching?(file) - file = @ph.xpath(file) - - if @files.member?(file) - true - elsif file.directory? - false - else - ext = @ph.normalize_extension(file.extname) - - file.dirname.ascend do |dir| - matching = @dirs[dir] - - if matching && (matching.empty? || matching.include?(ext)) - break true - elsif dir == @lcsp || dir.root? - break false - end - end - end - end - - def directories_to_watch - dtw = @files.map(&:dirname) + @dirs.keys - dtw.compact! - dtw.uniq! - - normalized_gem_paths = Gem.path.map { |path| File.join path, "" } - dtw = dtw.reject do |path| - normalized_gem_paths.any? { |gem_path| path.to_s.start_with?(gem_path) } - end - - @ph.filter_out_descendants(dtw) - end - - class PathHelper - def xpath(path) - Pathname.new(path).expand_path - end - - def normalize_extension(ext) - ext.to_s.sub(/\A\./, "") - end - - # Given a collection of Pathname objects returns the longest subpath - # common to all of them, or +nil+ if there is none. - def longest_common_subpath(paths) - return if paths.empty? - - lcsp = Pathname.new(paths[0]) - - paths[1..-1].each do |path| - until ascendant_of?(lcsp, path) - if lcsp.root? - # If we get here a root directory is not an ascendant of path. - # This may happen if there are paths in different drives on - # Windows. - return - else - lcsp = lcsp.parent - end - end - end - - lcsp - end - - # Returns the deepest existing ascendant, which could be the argument itself. - def existing_parent(dir) - dir.ascend do |ascendant| - break ascendant if ascendant.directory? - end - end - - # Filters out directories which are descendants of others in the collection (stable). - def filter_out_descendants(dirs) - return dirs if dirs.length < 2 - - dirs_sorted_by_nparts = dirs.sort_by { |dir| dir.each_filename.to_a.length } - descendants = [] - - until dirs_sorted_by_nparts.empty? - dir = dirs_sorted_by_nparts.shift - - dirs_sorted_by_nparts.reject! do |possible_descendant| - ascendant_of?(dir, possible_descendant) && descendants << possible_descendant - end - end - - # Array#- preserves order. - dirs - descendants - end - - private - def ascendant_of?(base, other) - base != other && other.ascend do |ascendant| - break true if base == ascendant - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/logger_silence.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/logger_silence.rb deleted file mode 100644 index b2444c1e34..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/logger_silence.rb +++ /dev/null @@ -1,45 +0,0 @@ -# frozen_string_literal: true - -require "active_support/concern" -require "active_support/core_ext/module/attribute_accessors" -require "active_support/logger_thread_safe_level" - -module LoggerSilence - extend ActiveSupport::Concern - - included do - ActiveSupport::Deprecation.warn( - "Including LoggerSilence is deprecated and will be removed in Rails 6.1. " \ - "Please use `ActiveSupport::LoggerSilence` instead" - ) - - include ActiveSupport::LoggerSilence - end -end - -module ActiveSupport - module LoggerSilence - extend ActiveSupport::Concern - - included do - cattr_accessor :silencer, default: true - include ActiveSupport::LoggerThreadSafeLevel - end - - # Silences the logger for the duration of the block. - def silence(temporary_level = Logger::ERROR) - if silencer - begin - old_local_level = local_level - self.local_level = temporary_level - - yield self - ensure - self.local_level = old_local_level - end - else - yield self - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/logger_thread_safe_level.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/logger_thread_safe_level.rb deleted file mode 100644 index 1775a41492..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/logger_thread_safe_level.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -require "active_support/concern" -require "active_support/core_ext/module/attribute_accessors" -require "concurrent" -require "fiber" - -module ActiveSupport - module LoggerThreadSafeLevel # :nodoc: - extend ActiveSupport::Concern - - included do - cattr_accessor :local_levels, default: Concurrent::Map.new(initial_capacity: 2), instance_accessor: false - end - - Logger::Severity.constants.each do |severity| - class_eval(<<-EOT, __FILE__, __LINE__ + 1) - def #{severity.downcase}? # def debug? - Logger::#{severity} >= level # DEBUG >= level - end # end - EOT - end - - def after_initialize - ActiveSupport::Deprecation.warn( - "Logger don't need to call #after_initialize directly anymore. It will be deprecated without replacement in " \ - "Rails 6.1." - ) - end - - def local_log_id - Fiber.current.__id__ - end - - def local_level - self.class.local_levels[local_log_id] - end - - def local_level=(level) - if level - self.class.local_levels[local_log_id] = level - else - self.class.local_levels.delete(local_log_id) - end - end - - def level - local_level || super - end - - def add(severity, message = nil, progname = nil, &block) # :nodoc: - return true if @logdev.nil? || (severity || UNKNOWN) < level - super - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/security_utils.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/security_utils.rb deleted file mode 100644 index 5e455fca57..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/security_utils.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -require "digest/sha2" - -module ActiveSupport - module SecurityUtils - # Constant time string comparison, for fixed length strings. - # - # The values compared should be of fixed length, such as strings - # that have already been processed by HMAC. Raises in case of length mismatch. - def fixed_length_secure_compare(a, b) - raise ArgumentError, "string length mismatch." unless a.bytesize == b.bytesize - - l = a.unpack "C#{a.bytesize}" - - res = 0 - b.each_byte { |byte| res |= byte ^ l.shift } - res == 0 - end - module_function :fixed_length_secure_compare - - # Constant time string comparison, for variable length strings. - # - # The values are first processed by SHA256, so that we don't leak length info - # via timing attacks. - def secure_compare(a, b) - fixed_length_secure_compare(::Digest::SHA256.digest(a), ::Digest::SHA256.digest(b)) && a == b - end - module_function :secure_compare - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/actionable_error.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/actionable_error.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/actionable_error.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/actionable_error.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/array_inquirer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/array_inquirer.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/array_inquirer.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/array_inquirer.rb index b2b9e9c0b7..0cbba0b6df 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/array_inquirer.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/array_inquirer.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "active_support/core_ext/symbol/starts_ends_with" + module ActiveSupport # Wrapping an array in an +ArrayInquirer+ gives a friendlier way to check # its string-like contents: @@ -34,11 +36,11 @@ module ActiveSupport private def respond_to_missing?(name, include_private = false) - (name[-1] == "?") || super + name.end_with?("?") || super end def method_missing(name, *args) - if name[-1] == "?" + if name.end_with?("?") any?(name[0..-2]) else super diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/backtrace_cleaner.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/backtrace_cleaner.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/backtrace_cleaner.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/backtrace_cleaner.rb index f55e821e10..03c7dc75d6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/backtrace_cleaner.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/backtrace_cleaner.rb @@ -16,7 +16,7 @@ module ActiveSupport # # bc = ActiveSupport::BacktraceCleaner.new # bc.add_filter { |line| line.gsub(Rails.root.to_s, '') } # strip the Rails.root prefix - # bc.add_silencer { |line| line =~ /puma|rubygems/ } # skip any lines from puma or rubygems + # bc.add_silencer { |line| /puma|rubygems/.match?(line) } # skip any lines from puma or rubygems # bc.clean(exception.backtrace) # perform the cleanup # # To reconfigure an existing BacktraceCleaner (like the default one in Rails) @@ -65,7 +65,7 @@ module ActiveSupport # for a given line, it will be excluded from the clean backtrace. # # # Will reject all lines that include the word "puma", like "/gems/puma/server.rb" or "/app/my_puma_server/rb" - # backtrace_cleaner.add_silencer { |line| line =~ /puma/ } + # backtrace_cleaner.add_silencer { |line| /puma/.match?(line) } def add_silencer(&block) @silencers << block end @@ -91,7 +91,7 @@ module ActiveSupport gems_paths = (Gem.path | [Gem.default_dir]).map { |p| Regexp.escape(p) } return if gems_paths.empty? - gems_regexp = %r{(#{gems_paths.join('|')})/(bundler/)?gems/([^/]+)-([\w.]+)/(.*)} + gems_regexp = %r{\A(#{gems_paths.join('|')})/(bundler/)?gems/([^/]+)-([\w.]+)/(.*)} gems_result = '\3 (\4) \5' add_filter { |line| line.sub(gems_regexp, gems_result) } end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/benchmarkable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/benchmarkable.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/benchmarkable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/benchmarkable.rb index f481d68198..abd0d59d9e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/benchmarkable.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/benchmarkable.rb @@ -41,7 +41,7 @@ module ActiveSupport result = nil ms = Benchmark.ms { result = options[:silence] ? logger.silence { yield } : yield } - logger.send(options[:level], "%s (%.1fms)" % [ message, ms ]) + logger.public_send(options[:level], "%s (%.1fms)" % [ message, ms ]) result else yield diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/builder.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/builder.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/builder.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/builder.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/callbacks.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/callbacks.rb index 11746e0537..1a55f8af35 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/callbacks.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/callbacks.rb @@ -4,10 +4,7 @@ require "active_support/concern" require "active_support/descendants_tracker" require "active_support/core_ext/array/extract_options" require "active_support/core_ext/class/attribute" -require "active_support/core_ext/kernel/reporting" -require "active_support/core_ext/kernel/singleton_class" require "active_support/core_ext/string/filters" -require "active_support/deprecation" require "thread" module ActiveSupport @@ -103,32 +100,6 @@ module ActiveSupport env = Filters::Environment.new(self, false, nil) next_sequence = callbacks.compile - invoke_sequence = Proc.new do - skipped = nil - while true - current = next_sequence - current.invoke_before(env) - if current.final? - env.value = !env.halted && (!block_given? || yield) - elsif current.skip?(env) - (skipped ||= []) << current - next_sequence = next_sequence.nested - next - else - next_sequence = next_sequence.nested - begin - target, block, method, *arguments = current.expand_call_template(env, invoke_sequence) - target.send(method, *arguments, &block) - ensure - next_sequence = current - end - end - current.invoke_after(env) - skipped.pop.invoke_after(env) while skipped && skipped.first - break env.value - end - end - # Common case: no 'around' callbacks defined if next_sequence.final? next_sequence.invoke_before(env) @@ -136,6 +107,33 @@ module ActiveSupport next_sequence.invoke_after(env) env.value else + invoke_sequence = Proc.new do + skipped = nil + + while true + current = next_sequence + current.invoke_before(env) + if current.final? + env.value = !env.halted && (!block_given? || yield) + elsif current.skip?(env) + (skipped ||= []) << current + next_sequence = next_sequence.nested + next + else + next_sequence = next_sequence.nested + begin + target, block, method, *arguments = current.expand_call_template(env, invoke_sequence) + target.send(method, *arguments, &block) + ensure + next_sequence = current + end + end + current.invoke_after(env) + skipped.pop.invoke_after(env) while skipped&.first + break env.value + end + end + invoke_sequence.call end end @@ -145,7 +143,7 @@ module ActiveSupport # A hook invoked every time a before callback is halted. # This can be overridden in ActiveSupport::Callbacks implementors in order # to provide better debugging/logging. - def halted_callback_hook(filter) + def halted_callback_hook(filter, name) end module Conditionals # :nodoc: @@ -161,17 +159,17 @@ module ActiveSupport Environment = Struct.new(:target, :halted, :value) class Before - def self.build(callback_sequence, user_callback, user_conditions, chain_config, filter) + def self.build(callback_sequence, user_callback, user_conditions, chain_config, filter, name) halted_lambda = chain_config[:terminator] if user_conditions.any? - halting_and_conditional(callback_sequence, user_callback, user_conditions, halted_lambda, filter) + halting_and_conditional(callback_sequence, user_callback, user_conditions, halted_lambda, filter, name) else - halting(callback_sequence, user_callback, halted_lambda, filter) + halting(callback_sequence, user_callback, halted_lambda, filter, name) end end - def self.halting_and_conditional(callback_sequence, user_callback, user_conditions, halted_lambda, filter) + def self.halting_and_conditional(callback_sequence, user_callback, user_conditions, halted_lambda, filter, name) callback_sequence.before do |env| target = env.target value = env.value @@ -181,7 +179,7 @@ module ActiveSupport result_lambda = -> { user_callback.call target, value } env.halted = halted_lambda.call(target, result_lambda) if env.halted - target.send :halted_callback_hook, filter + target.send :halted_callback_hook, filter, name end end @@ -190,7 +188,7 @@ module ActiveSupport end private_class_method :halting_and_conditional - def self.halting(callback_sequence, user_callback, halted_lambda, filter) + def self.halting(callback_sequence, user_callback, halted_lambda, filter, name) callback_sequence.before do |env| target = env.target value = env.value @@ -199,9 +197,8 @@ module ActiveSupport unless halted result_lambda = -> { user_callback.call target, value } env.halted = halted_lambda.call(target, result_lambda) - if env.halted - target.send :halted_callback_hook, filter + target.send :halted_callback_hook, filter, name end end @@ -300,8 +297,8 @@ module ActiveSupport @kind = kind @filter = filter @key = compute_identifier filter - @if = check_conditionals(Array(options[:if])) - @unless = check_conditionals(Array(options[:unless])) + @if = check_conditionals(options[:if]) + @unless = check_conditionals(options[:unless]) end def filter; @key; end @@ -339,7 +336,7 @@ module ActiveSupport case kind when :before - Filters::Before.build(callback_sequence, user_callback.make_lambda, user_conditions, chain_config, @filter) + Filters::Before.build(callback_sequence, user_callback.make_lambda, user_conditions, chain_config, @filter, name) when :after Filters::After.build(callback_sequence, user_callback.make_lambda, user_conditions, chain_config) when :around @@ -352,7 +349,13 @@ module ActiveSupport end private + EMPTY_ARRAY = [].freeze + private_constant :EMPTY_ARRAY + def check_conditionals(conditionals) + return EMPTY_ARRAY if conditionals.blank? + + conditionals = Array(conditionals) if conditionals.any? { |c| c.is_a?(String) } raise ArgumentError, <<-MSG.squish Passing string to be evaluated in :if and :unless conditional @@ -361,7 +364,7 @@ module ActiveSupport MSG end - conditionals + conditionals.freeze end def compute_identifier(filter) @@ -403,21 +406,17 @@ module ActiveSupport # The actual invocation is left up to the caller to minimize # call stack pollution. def expand(target, value, block) - result = @arguments.map { |arg| + expanded = [@override_target || target, @override_block || block, @method_name] + + @arguments.each do |arg| case arg - when :value; value - when :target; target - when :block; block || raise(ArgumentError) + when :value then expanded << value + when :target then expanded << target + when :block then expanded << (block || raise(ArgumentError)) end - } + end - result.unshift @method_name - result.unshift @override_block || block - result.unshift @override_target || target - - # target, block, method, *arguments = result - # target.send(method, *arguments, &block) - result + expanded end # Return a lambda that will make this call when given the input @@ -845,8 +844,18 @@ module ActiveSupport __callbacks[name.to_sym] end - def set_callbacks(name, callbacks) # :nodoc: - self.__callbacks = __callbacks.merge(name.to_sym => callbacks) + if Module.instance_method(:method_defined?).arity == 1 # Ruby 2.5 and older + def set_callbacks(name, callbacks) # :nodoc: + self.__callbacks = __callbacks.merge(name.to_sym => callbacks) + end + else # Ruby 2.6 and newer + def set_callbacks(name, callbacks) # :nodoc: + unless singleton_class.method_defined?(:__callbacks, false) + self.__callbacks = __callbacks.dup + end + self.__callbacks[name.to_sym] = callbacks + self.__callbacks + end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/concern.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/concern.rb similarity index 73% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/concern.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/concern.rb index 708c445031..e88862bfb4 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/concern.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/concern.rb @@ -19,7 +19,7 @@ module ActiveSupport # By using ActiveSupport::Concern the above module could instead be # written as: # - # require 'active_support/concern' + # require "active_support/concern" # # module M # extend ActiveSupport::Concern @@ -76,7 +76,7 @@ module ActiveSupport # is the +Bar+ module, not the +Host+ class. With ActiveSupport::Concern, # module dependencies are properly resolved: # - # require 'active_support/concern' + # require "active_support/concern" # # module Foo # extend ActiveSupport::Concern @@ -99,6 +99,14 @@ module ActiveSupport # class Host # include Bar # It works, now Bar takes care of its dependencies # end + # + # === Prepending concerns + # + # Just like include, concerns also support prepend with a corresponding + # prepended do callback. module ClassMethods or class_methods do are + # prepended as well. + # + # prepend is also used for any dependencies. module Concern class MultipleIncludedBlocks < StandardError #:nodoc: def initialize @@ -106,6 +114,12 @@ module ActiveSupport end end + class MultiplePrependBlocks < StandardError #:nodoc: + def initialize + super "Cannot define multiple 'prepended' blocks for a Concern" + end + end + def self.extended(base) #:nodoc: base.instance_variable_set(:@_dependencies, []) end @@ -123,6 +137,19 @@ module ActiveSupport end end + def prepend_features(base) #:nodoc: + if base.instance_variable_defined?(:@_dependencies) + base.instance_variable_get(:@_dependencies).unshift self + false + else + return false if base < self + @_dependencies.each { |dep| base.prepend(dep) } + super + base.singleton_class.prepend const_get(:ClassMethods) if const_defined?(:ClassMethods) + base.class_eval(&@_prepended_block) if instance_variable_defined?(:@_prepended_block) + end + end + # Evaluate given block in context of base class, # so that you can write class macros here. # When you define more than one +included+ block, it raises an exception. @@ -140,6 +167,23 @@ module ActiveSupport end end + # Evaluate given block in context of base class, + # so that you can write class macros here. + # When you define more than one +prepended+ block, it raises an exception. + def prepended(base = nil, &block) + if base.nil? + if instance_variable_defined?(:@_prepended_block) + if @_prepended_block.source_location != block.source_location + raise MultiplePrependBlocks + end + else + @_prepended_block = block + end + else + super + end + end + # Define class methods from given block. # You can define private class methods as well. # diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/configurable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/configurable.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/configurable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/configurable.rb index 71c23dae9b..92bd411df5 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/configurable.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/configurable.rb @@ -5,7 +5,7 @@ require "active_support/ordered_options" module ActiveSupport # Configurable provides a config method to store and retrieve - # configuration options as an OrderedHash. + # configuration options as an OrderedOptions. module Configurable extend ActiveSupport::Concern @@ -124,9 +124,9 @@ module ActiveSupport private :config_accessor end - # Reads and writes attributes from a configuration OrderedHash. + # Reads and writes attributes from a configuration OrderedOptions. # - # require 'active_support/configurable' + # require "active_support/configurable" # # class User # include ActiveSupport::Configurable diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/configuration_file.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/configuration_file.rb new file mode 100644 index 0000000000..bf8d209a6c --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/configuration_file.rb @@ -0,0 +1,46 @@ +# frozen_string_literal: true + +module ActiveSupport + # Reads a YAML configuration file, evaluating any ERB, then + # parsing the resulting YAML. + # + # Warns in case of YAML confusing characters, like invisible + # non-breaking spaces. + class ConfigurationFile # :nodoc: + class FormatError < StandardError; end + + def initialize(content_path) + @content_path = content_path.to_s + @content = read content_path + end + + def self.parse(content_path, **options) + new(content_path).parse(**options) + end + + def parse(context: nil, **options) + YAML.load(render(context), **options) || {} + rescue Psych::SyntaxError => error + raise "YAML syntax error occurred while parsing #{@content_path}. " \ + "Please note that YAML must be consistently indented using spaces. Tabs are not allowed. " \ + "Error: #{error.message}" + end + + private + def read(content_path) + require "yaml" + require "erb" + + File.read(content_path).tap do |content| + if content.include?("\u00A0") + warn "File contains invisible non-breaking spaces, you may want to remove those" + end + end + end + + def render(context) + erb = ERB.new(@content).tap { |e| e.filename = @content_path } + context ? erb.result(context) : erb.result + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/array.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/array.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array/access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/array/access.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array/access.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/array/access.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/array/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/array/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array/extract.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/array/extract.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array/extract.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/array/extract.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array/extract_options.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/array/extract_options.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array/extract_options.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/array/extract_options.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array/grouping.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/array/grouping.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array/grouping.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/array/grouping.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array/inquiry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/array/inquiry.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array/inquiry.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/array/inquiry.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array/wrap.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/array/wrap.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/array/wrap.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/array/wrap.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/benchmark.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/benchmark.rb similarity index 83% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/benchmark.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/benchmark.rb index 641b58c8b8..f6e1b72bcf 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/benchmark.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/benchmark.rb @@ -10,7 +10,7 @@ class << Benchmark # # Benchmark.ms { User.all } # # => 0.074 - def ms - 1000 * realtime { yield } + def ms(&block) + 1000 * realtime(&block) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/big_decimal.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/big_decimal.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/big_decimal.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/big_decimal.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/big_decimal/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/big_decimal/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/big_decimal/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/big_decimal/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/class.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/class.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/class.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/class.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/class/attribute.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/class/attribute.rb similarity index 68% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/class/attribute.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/class/attribute.rb index 255cbee55c..ec78845159 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/class/attribute.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/class/attribute.rb @@ -1,8 +1,6 @@ # frozen_string_literal: true -require "active_support/core_ext/kernel/singleton_class" require "active_support/core_ext/module/redefine_method" -require "active_support/core_ext/array/extract_options" class Class # Declare a class-level attribute whose value is inheritable by subclasses. @@ -84,58 +82,50 @@ class Class # To set a default value for the attribute, pass default:, like so: # # class_attribute :settings, default: {} - def class_attribute( - *attrs, - instance_accessor: true, - instance_reader: instance_accessor, - instance_writer: instance_accessor, - instance_predicate: true, - default: nil - ) + def class_attribute(*attrs, instance_accessor: true, + instance_reader: instance_accessor, instance_writer: instance_accessor, instance_predicate: true, default: nil) + + class_methods, methods = [], [] attrs.each do |name| - singleton_class.silence_redefinition_of_method(name) - define_singleton_method(name) { default } - - singleton_class.silence_redefinition_of_method("#{name}?") - define_singleton_method("#{name}?") { !!public_send(name) } if instance_predicate - - ivar = "@#{name}".to_sym - - singleton_class.silence_redefinition_of_method("#{name}=") - define_singleton_method("#{name}=") do |val| - redefine_singleton_method(name) { val } - - if singleton_class? - class_eval do - redefine_method(name) do - if instance_variable_defined? ivar - instance_variable_get ivar - else - singleton_class.send name - end - end - end - end - val + unless name.is_a?(Symbol) || name.is_a?(String) + raise TypeError, "#{name.inspect} is not a symbol nor a string" end - if instance_reader - redefine_method(name) do - if instance_variable_defined?(ivar) - instance_variable_get ivar - else - self.class.public_send name - end + class_methods << <<~RUBY # In case the method exists and is not public + silence_redefinition_of_method def #{name} end + RUBY - redefine_method("#{name}?") { !!public_send(name) } if instance_predicate - end + methods << <<~RUBY if instance_reader + silence_redefinition_of_method def #{name} + defined?(@#{name}) ? @#{name} : self.class.#{name} + end + RUBY - if instance_writer - redefine_method("#{name}=") do |val| - instance_variable_set ivar, val + class_methods << <<~RUBY + silence_redefinition_of_method def #{name}=(value) + redefine_method(:#{name}) { value } if singleton_class? + redefine_singleton_method(:#{name}) { value } + value + end + RUBY + + methods << <<~RUBY if instance_writer + silence_redefinition_of_method(:#{name}=) + attr_writer :#{name} + RUBY + + if instance_predicate + class_methods << "silence_redefinition_of_method def #{name}?; !!self.#{name}; end" + if instance_reader + methods << "silence_redefinition_of_method def #{name}?; !!self.#{name}; end" end end end + + location = caller_locations(1, 1).first + class_eval(["class << self", *class_methods, "end", *methods].join(";").tr("\n", ";"), location.path, location.lineno) + + attrs.each { |name| public_send("#{name}=", default) } end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/class/attribute_accessors.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/class/attribute_accessors.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/class/attribute_accessors.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/class/attribute_accessors.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/class/subclasses.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/class/subclasses.rb new file mode 100644 index 0000000000..568b413516 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/class/subclasses.rb @@ -0,0 +1,33 @@ +# frozen_string_literal: true + +class Class + # Returns an array with all classes that are < than its receiver. + # + # class C; end + # C.descendants # => [] + # + # class B < C; end + # C.descendants # => [B] + # + # class A < B; end + # C.descendants # => [B, A] + # + # class D < C; end + # C.descendants # => [B, A, D] + def descendants + ObjectSpace.each_object(singleton_class).reject do |k| + k.singleton_class? || k == self + end + end + + # Returns an array with the direct children of +self+. + # + # class Foo; end + # class Bar < Foo; end + # class Baz < Bar; end + # + # Foo.subclasses # => [Bar] + def subclasses + descendants.select { |descendant| descendant.superclass == self } + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date/acts_like.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date/acts_like.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date/acts_like.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date/acts_like.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date/blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date/blank.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date/blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date/blank.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date/calculations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date/calculations.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date/calculations.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date/calculations.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date/conversions.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date/conversions.rb index 870119dc7f..050a62bb31 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date/conversions.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date/conversions.rb @@ -10,6 +10,7 @@ class Date short: "%d %b", long: "%B %d, %Y", db: "%Y-%m-%d", + inspect: "%Y-%m-%d", number: "%Y%m%d", long_ordinal: lambda { |date| day_format = ActiveSupport::Inflector.ordinalize(date.day) @@ -80,7 +81,7 @@ class Date # If the *application's* timezone is needed, then use +in_time_zone+ instead. def to_time(form = :local) raise ArgumentError, "Expected :local or :utc, got #{form.inspect}." unless [:local, :utc].include?(form) - ::Time.send(form, year, month, day) + ::Time.public_send(form, year, month, day) end silence_redefinition_of_method :xmlschema diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date/zones.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date/zones.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date/zones.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date/zones.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_and_time/calculations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_and_time/calculations.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_and_time/calculations.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_and_time/calculations.rb index c7a2378e41..21cfeed557 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_and_time/calculations.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_and_time/calculations.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "active_support/core_ext/object/try" +require "active_support/core_ext/date_time/conversions" module DateAndTime module Calculations @@ -30,6 +31,18 @@ module DateAndTime to_date == ::Date.current end + # Returns true if the date/time is tomorrow. + def tomorrow? + to_date == ::Date.current.tomorrow + end + alias :next_day? :tomorrow? + + # Returns true if the date/time is yesterday. + def yesterday? + to_date == ::Date.current.yesterday + end + alias :prev_day? :yesterday? + # Returns true if the date/time is in the past. def past? self < self.class.current diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_and_time/compatibility.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_and_time/compatibility.rb new file mode 100644 index 0000000000..b40a0fabb1 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_and_time/compatibility.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +require "active_support/core_ext/module/attribute_accessors" + +module DateAndTime + module Compatibility + # If true, +to_time+ preserves the timezone offset of receiver. + # + # NOTE: With Ruby 2.4+ the default for +to_time+ changed from + # converting to the local system time, to preserving the offset + # of the receiver. For backwards compatibility we're overriding + # this behavior, but new apps will have an initializer that sets + # this to true, because the new behavior is preferred. + mattr_accessor :preserve_timezone, instance_writer: false, default: false + + # Change the output of ActiveSupport::TimeZone.utc_to_local. + # + # When `true`, it returns local times with an UTC offset, with `false` local + # times are returned as UTC. + # + # # Given this zone: + # zone = ActiveSupport::TimeZone["Eastern Time (US & Canada)"] + # + # # With `utc_to_local_returns_utc_offset_times = false`, local time is converted to UTC: + # zone.utc_to_local(Time.utc(2000, 1)) # => 1999-12-31 19:00:00 UTC + # + # # With `utc_to_local_returns_utc_offset_times = true`, local time is returned with UTC offset: + # zone.utc_to_local(Time.utc(2000, 1)) # => 1999-12-31 19:00:00 -0500 + mattr_accessor :utc_to_local_returns_utc_offset_times, instance_writer: false, default: false + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_and_time/zones.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_and_time/zones.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_and_time/zones.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_and_time/zones.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_time.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_time.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_time/acts_like.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_time/acts_like.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_time/acts_like.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_time/acts_like.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_time/blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_time/blank.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_time/blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_time/blank.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_time/calculations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_time/calculations.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_time/calculations.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_time/calculations.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_time/compatibility.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_time/compatibility.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_time/compatibility.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_time/compatibility.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_time/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_time/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/date_time/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/date_time/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/digest.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/digest.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/digest.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/digest.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/digest/uuid.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/digest/uuid.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/digest/uuid.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/digest/uuid.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/enumerable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/enumerable.rb similarity index 67% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/enumerable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/enumerable.rb index 4675c41936..97c918a71f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/enumerable.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/enumerable.rb @@ -44,7 +44,8 @@ module Enumerable end end - # Convert an enumerable to a hash keying it by the block return value. + # Convert an enumerable to a hash, using the block result as the key and the + # element as the value. # # people.index_by(&:login) # # => { "nextangle" => , "chade-" => , ...} @@ -61,12 +62,19 @@ module Enumerable end end - # Convert an enumerable to a hash keying it with the enumerable items and with the values returned in the block. + # Convert an enumerable to a hash, using the element as the key and the block + # result as the value. # # post = Post.new(title: "hey there", body: "what's up?") # # %i( title body ).index_with { |attr_name| post.public_send(attr_name) } # # => { title: "hey there", body: "what's up?" } + # + # If an argument is passed instead of a block, it will be used as the value + # for all elements: + # + # %i( created_at updated_at ).index_with(Time.now) + # # => { created_at: 2020-03-09 22:31:47, updated_at: 2020-03-09 22:31:47 } def index_with(default = INDEX_WITH_DEFAULT) if block_given? result = {} @@ -134,7 +142,7 @@ module Enumerable excluding(*elements) end - # Convert an enumerable to an array based on the given key. + # Extract the given key from each element in the enumerable. # # [{ name: "David" }, { name: "Rafael" }, { name: "Aaron" }].pluck(:name) # # => ["David", "Rafael", "Aaron"] @@ -145,9 +153,62 @@ module Enumerable if keys.many? map { |element| keys.map { |key| element[key] } } else - map { |element| element[keys.first] } + key = keys.first + map { |element| element[key] } end end + + # Extract the given key from the first element in the enumerable. + # + # [{ name: "David" }, { name: "Rafael" }, { name: "Aaron" }].pick(:name) + # # => "David" + # + # [{ id: 1, name: "David" }, { id: 2, name: "Rafael" }].pick(:id, :name) + # # => [1, "David"] + def pick(*keys) + return if none? + + if keys.many? + keys.map { |key| first[key] } + else + first[keys.first] + end + end + + # Returns a new +Array+ without the blank items. + # Uses Object#blank? for determining if an item is blank. + # + # [1, "", nil, 2, " ", [], {}, false, true].compact_blank + # # => [1, 2, true] + # + # Set.new([nil, "", 1, 2]) + # # => [2, 1] (or [1, 2]) + # + # When called on a +Hash+, returns a new +Hash+ without the blank values. + # + # { a: "", b: 1, c: nil, d: [], e: false, f: true }.compact_blank + # #=> { b: 1, f: true } + def compact_blank + reject(&:blank?) + end +end + +class Hash + # Hash#reject has its own definition, so this needs one too. + def compact_blank #:nodoc: + reject { |_k, v| v.blank? } + end + + # Removes all blank values from the +Hash+ in place and returns self. + # Uses Object#blank? for determining if a value is blank. + # + # h = { a: "", b: 1, c: nil, d: [], e: false, f: true } + # h.compact_blank! + # # => { b: 1, f: true } + def compact_blank! + # use delete_if rather than reject! because it always returns self even if nothing changed + delete_if { |_k, v| v.blank? } + end end class Range #:nodoc: @@ -185,4 +246,15 @@ class Array #:nodoc: super end end + + # Removes all blank elements from the +Array+ in place and returns self. + # Uses Object#blank? for determining if an item is blank. + # + # a = [1, "", nil, 2, " ", [], {}, false, true] + # a.compact_blank! + # # => [1, 2, true] + def compact_blank! + # use delete_if rather than reject! because it always returns self even if nothing changed + delete_if(&:blank?) + end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/file.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/file.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/file.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/file.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/file/atomic.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/file/atomic.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/file/atomic.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/file/atomic.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/conversions.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/conversions.rb index 61cbcaff27..2b5e484d21 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/conversions.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/conversions.rb @@ -1,10 +1,10 @@ # frozen_string_literal: true require "active_support/xml_mini" -require "active_support/time" require "active_support/core_ext/object/blank" require "active_support/core_ext/object/to_param" require "active_support/core_ext/object/to_query" +require "active_support/core_ext/object/try" require "active_support/core_ext/array/wrap" require "active_support/core_ext/hash/reverse_merge" require "active_support/core_ext/string/inflections" @@ -208,7 +208,7 @@ module ActiveSupport elsif become_empty_string?(value) "" elsif become_hash?(value) - xml_value = Hash[value.map { |k, v| [k, deep_to_h(v)] }] + xml_value = value.transform_values { |v| deep_to_h(v) } # Turn { files: { file: # } } into { files: # } so it is compatible with # how multipart uploaded files from HTML appear diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/deep_merge.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/deep_merge.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/deep_merge.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/deep_merge.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/deep_transform_values.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/deep_transform_values.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/deep_transform_values.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/deep_transform_values.rb index 18acb1e70c..8ad85c0a6d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/deep_transform_values.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/deep_transform_values.rb @@ -21,7 +21,7 @@ class Hash end private - # support methods for deep transforming nested hashes and arrays + # Support methods for deep transforming nested hashes and arrays. def _deep_transform_values_in_object(object, &block) case object when Hash diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/except.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/except.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/except.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/except.rb index 5013812460..ec96929b0a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/except.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/except.rb @@ -11,7 +11,7 @@ class Hash # @person.update(params[:person].except(:admin)) def except(*keys) slice(*self.keys - keys) - end + end unless method_defined?(:except) # Removes the given keys from hash and returns it. # hash = { a: true, b: false, c: nil } diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/indifferent_access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/indifferent_access.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/indifferent_access.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/indifferent_access.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/keys.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/keys.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/keys.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/keys.rb index 7d3495db2c..f2db61f386 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/keys.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/keys.rb @@ -112,7 +112,7 @@ class Hash end private - # support methods for deep transforming nested hashes and arrays + # Support methods for deep transforming nested hashes and arrays. def _deep_transform_keys_in_object(object, &block) case object when Hash diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/reverse_merge.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/reverse_merge.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/reverse_merge.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/reverse_merge.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/slice.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/slice.rb similarity index 83% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/slice.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/slice.rb index 3d0f8a1e62..56bc5de382 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/hash/slice.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/hash/slice.rb @@ -18,8 +18,9 @@ class Hash # Removes and returns the key/value pairs matching the given keys. # - # { a: 1, b: 2, c: 3, d: 4 }.extract!(:a, :b) # => {:a=>1, :b=>2} - # { a: 1, b: 2 }.extract!(:a, :x) # => {:a=>1} + # hash = { a: 1, b: 2, c: 3, d: 4 } + # hash.extract!(:a, :b) # => {:a=>1, :b=>2} + # hash # => {:c=>3, :d=>4} def extract!(*keys) keys.each_with_object(self.class.new) { |key, result| result[key] = delete(key) if has_key?(key) } end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/integer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/integer.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/integer.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/integer.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/integer/inflections.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/integer/inflections.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/integer/inflections.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/integer/inflections.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/integer/multiple.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/integer/multiple.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/integer/multiple.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/integer/multiple.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/integer/time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/integer/time.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/integer/time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/integer/time.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/kernel.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/kernel.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/kernel.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/kernel.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/kernel/concern.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/kernel/concern.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/kernel/concern.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/kernel/concern.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/kernel/reporting.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/kernel/reporting.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/kernel/reporting.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/kernel/reporting.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/kernel/singleton_class.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/kernel/singleton_class.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/kernel/singleton_class.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/kernel/singleton_class.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/load_error.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/load_error.rb similarity index 77% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/load_error.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/load_error.rb index b81ed0605e..03df2ddac4 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/load_error.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/load_error.rb @@ -4,6 +4,6 @@ class LoadError # Returns true if the given path name (except perhaps for the ".rb" # extension) is the missing file which caused the exception to be raised. def is_missing?(location) - location.sub(/\.rb$/, "") == path.to_s.sub(/\.rb$/, "") + location.delete_suffix(".rb") == path.to_s.delete_suffix(".rb") end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/marshal.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/marshal.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/marshal.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/marshal.rb index 0c72cd7b47..5ff0e34d82 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/marshal.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/marshal.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "active_support/core_ext/string/inflections" + module ActiveSupport module MarshalWithAutoloading # :nodoc: def load(source, proc = nil) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/aliasing.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/aliasing.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/aliasing.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/aliasing.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/anonymous.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/anonymous.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/anonymous.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/anonymous.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/attr_internal.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/attr_internal.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/attr_internal.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/attr_internal.rb index 7801f6d181..3bd66ff3bc 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/attr_internal.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/attr_internal.rb @@ -28,9 +28,9 @@ class Module end def attr_internal_define(attr_name, type) - internal_name = attr_internal_ivar_name(attr_name).sub(/\A@/, "") + internal_name = attr_internal_ivar_name(attr_name).delete_prefix("@") # use native attr_* methods as they are faster on some Ruby implementations - send("attr_#{type}", internal_name) + public_send("attr_#{type}", internal_name) attr_name, internal_name = "#{attr_name}=", "#{internal_name}=" if type == :writer alias_method attr_name, internal_name remove_method internal_name diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/attribute_accessors.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/attribute_accessors.rb similarity index 83% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/attribute_accessors.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/attribute_accessors.rb index cc1926e022..1db905ff65 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/attribute_accessors.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/attribute_accessors.rb @@ -48,28 +48,25 @@ class Module # end # # Person.new.hair_colors # => [:brown, :black, :blonde, :red] - def mattr_reader(*syms, instance_reader: true, instance_accessor: true, default: nil) + def mattr_reader(*syms, instance_reader: true, instance_accessor: true, default: nil, location: nil) + raise TypeError, "module attributes should be defined directly on class, not singleton" if singleton_class? + location ||= caller_locations(1, 1).first + + definition = [] syms.each do |sym| raise NameError.new("invalid attribute name: #{sym}") unless /\A[_A-Za-z]\w*\z/.match?(sym) - class_eval(<<-EOS, __FILE__, __LINE__ + 1) - @@#{sym} = nil unless defined? @@#{sym} - def self.#{sym} - @@#{sym} - end - EOS + definition << "def self.#{sym}; @@#{sym}; end" if instance_reader && instance_accessor - class_eval(<<-EOS, __FILE__, __LINE__ + 1) - def #{sym} - @@#{sym} - end - EOS + definition << "def #{sym}; @@#{sym}; end" end sym_default_value = (block_given? && default.nil?) ? yield : default - class_variable_set("@@#{sym}", sym_default_value) unless sym_default_value.nil? + class_variable_set("@@#{sym}", sym_default_value) unless sym_default_value.nil? && class_variable_defined?("@@#{sym}") end + + module_eval(definition.join(";"), location.path, location.lineno) end alias :cattr_reader :mattr_reader @@ -115,28 +112,24 @@ class Module # end # # Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red] - def mattr_writer(*syms, instance_writer: true, instance_accessor: true, default: nil) + def mattr_writer(*syms, instance_writer: true, instance_accessor: true, default: nil, location: nil) + raise TypeError, "module attributes should be defined directly on class, not singleton" if singleton_class? + location ||= caller_locations(1, 1).first + + definition = [] syms.each do |sym| raise NameError.new("invalid attribute name: #{sym}") unless /\A[_A-Za-z]\w*\z/.match?(sym) - class_eval(<<-EOS, __FILE__, __LINE__ + 1) - @@#{sym} = nil unless defined? @@#{sym} - - def self.#{sym}=(obj) - @@#{sym} = obj - end - EOS + definition << "def self.#{sym}=(val); @@#{sym} = val; end" if instance_writer && instance_accessor - class_eval(<<-EOS, __FILE__, __LINE__ + 1) - def #{sym}=(obj) - @@#{sym} = obj - end - EOS + definition << "def #{sym}=(val); @@#{sym} = val; end" end sym_default_value = (block_given? && default.nil?) ? yield : default - send("#{sym}=", sym_default_value) unless sym_default_value.nil? + class_variable_set("@@#{sym}", sym_default_value) unless sym_default_value.nil? && class_variable_defined?("@@#{sym}") end + + module_eval(definition.join(";"), location.path, location.lineno) end alias :cattr_writer :mattr_writer @@ -205,8 +198,9 @@ class Module # # Person.class_variable_get("@@hair_colors") # => [:brown, :black, :blonde, :red] def mattr_accessor(*syms, instance_reader: true, instance_writer: true, instance_accessor: true, default: nil, &blk) - mattr_reader(*syms, instance_reader: instance_reader, instance_accessor: instance_accessor, default: default, &blk) - mattr_writer(*syms, instance_writer: instance_writer, instance_accessor: instance_accessor, default: default) + location = caller_locations(1, 1).first + mattr_reader(*syms, instance_reader: instance_reader, instance_accessor: instance_accessor, default: default, location: location, &blk) + mattr_writer(*syms, instance_writer: instance_writer, instance_accessor: instance_accessor, default: default, location: location) end alias :cattr_accessor :mattr_accessor end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb index a6e87aeb68..ea4034303e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/attribute_accessors_per_thread.rb @@ -33,7 +33,7 @@ class Module # end # # Current.new.user # => NoMethodError - def thread_mattr_reader(*syms, instance_reader: true, instance_accessor: true) # :nodoc: + def thread_mattr_reader(*syms, instance_reader: true, instance_accessor: true, default: nil) # :nodoc: syms.each do |sym| raise NameError.new("invalid attribute name: #{sym}") unless /^[_A-Za-z]\w*$/.match?(sym) @@ -52,6 +52,8 @@ class Module end EOS end + + Thread.current["attr_" + name + "_#{sym}"] = default unless default.nil? end end alias :thread_cattr_reader :thread_mattr_reader @@ -74,7 +76,7 @@ class Module # end # # Current.new.user = "DHH" # => NoMethodError - def thread_mattr_writer(*syms, instance_writer: true, instance_accessor: true) # :nodoc: + def thread_mattr_writer(*syms, instance_writer: true, instance_accessor: true, default: nil) # :nodoc: syms.each do |sym| raise NameError.new("invalid attribute name: #{sym}") unless /^[_A-Za-z]\w*$/.match?(sym) @@ -93,6 +95,8 @@ class Module end EOS end + + public_send("#{sym}=", default) unless default.nil? end end alias :thread_cattr_writer :thread_mattr_writer @@ -136,8 +140,8 @@ class Module # # Current.new.user = "DHH" # => NoMethodError # Current.new.user # => NoMethodError - def thread_mattr_accessor(*syms, instance_reader: true, instance_writer: true, instance_accessor: true) - thread_mattr_reader(*syms, instance_reader: instance_reader, instance_accessor: instance_accessor) + def thread_mattr_accessor(*syms, instance_reader: true, instance_writer: true, instance_accessor: true, default: nil) + thread_mattr_reader(*syms, instance_reader: instance_reader, instance_accessor: instance_accessor, default: default) thread_mattr_writer(*syms, instance_writer: instance_writer, instance_accessor: instance_accessor) end alias :thread_cattr_accessor :thread_mattr_accessor diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/concerning.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/concerning.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/concerning.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/concerning.rb index 7bbbf321ab..36f5f85937 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/concerning.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/concerning.rb @@ -104,10 +104,16 @@ class Module # * grok the behavior of our class in one glance, # * clean up monolithic junk-drawer classes by separating their concerns, and # * stop leaning on protected/private for crude "this is internal stuff" modularity. + # + # === Prepending concerning + # + # concerning supports a prepend: true argument which will prepend the + # concern instead of using include for it. module Concerning # Define a new concern and mix it in. - def concerning(topic, &block) - include concern(topic, &block) + def concerning(topic, prepend: false, &block) + method = prepend ? :prepend : :include + __send__(method, concern(topic, &block)) end # A low-cruft shortcut to define a concern. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/delegation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/delegation.rb similarity index 85% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/delegation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/delegation.rb index 893e3aff54..a44a3e7c74 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/delegation.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/delegation.rb @@ -170,7 +170,7 @@ class Module # The target method must be public, otherwise it will raise +NoMethodError+. def delegate(*methods, to: nil, prefix: nil, allow_nil: nil, private: nil) unless to - raise ArgumentError, "Delegation needs a target. Supply an options hash with a :to key as the last argument (e.g. delegate :hello, to: :greeter)." + raise ArgumentError, "Delegation needs a target. Supply a keyword argument 'to' (e.g. delegate :hello, to: :greeter)." end if prefix == true && /^[^a-z_]/.match?(to) @@ -190,7 +190,13 @@ class Module to = to.to_s to = "self.#{to}" if DELEGATION_RESERVED_METHOD_NAMES.include?(to) - method_names = methods.map do |method| + method_def = [] + method_names = [] + + methods.map do |method| + method_name = prefix ? "#{method_prefix}#{method}" : method + method_names << method_name.to_sym + # Attribute writer methods only accept one argument. Makes sure []= # methods still accept two arguments. definition = if /[^\]]=$/.match?(method) @@ -209,34 +215,33 @@ class Module # whereas conceptually, from the user point of view, the delegator should # be doing one call. if allow_nil - method_def = [ - "def #{method_prefix}#{method}(#{definition})", - "_ = #{to}", - "if !_.nil? || nil.respond_to?(:#{method})", - " _.#{method}(#{definition})", - "end", - "end" - ].join ";" - else - exception = %(raise DelegationError, "#{self}##{method_prefix}#{method} delegated to #{to}.#{method}, but #{to} is nil: \#{self.inspect}") + method = method.to_s - method_def = [ - "def #{method_prefix}#{method}(#{definition})", - " _ = #{to}", - " _.#{method}(#{definition})", - "rescue NoMethodError => e", - " if _.nil? && e.name == :#{method}", - " #{exception}", - " else", - " raise", - " end", + method_def << + "def #{method_name}(#{definition})" << + " _ = #{to}" << + " if !_.nil? || nil.respond_to?(:#{method})" << + " _.#{method}(#{definition})" << + " end" << + "end" + else + method = method.to_s + method_name = method_name.to_s + + method_def << + "def #{method_name}(#{definition})" << + " _ = #{to}" << + " _.#{method}(#{definition})" << + "rescue NoMethodError => e" << + " if _.nil? && e.name == :#{method}" << + %( raise DelegationError, "#{self}##{method_name} delegated to #{to}.#{method}, but #{to} is nil: \#{self.inspect}") << + " else" << + " raise" << + " end" << "end" - ].join ";" end - - module_eval(method_def, file, line) end - + module_eval(method_def.join(";"), file, line) private(*method_names) if private method_names end @@ -280,13 +285,14 @@ class Module # variables, methods, constants, etc. # # The delegated method must be public on the target, otherwise it will - # raise +NoMethodError+. + # raise +DelegationError+. If you wish to instead return +nil+, + # use the :allow_nil option. # # The marshal_dump and _dump methods are exempt from # delegation due to possible interference when calling # Marshal.dump(object), should the delegation target method # of object add or remove instance variables. - def delegate_missing_to(target) + def delegate_missing_to(target, allow_nil: nil) target = target.to_s target = "self.#{target}" if DELEGATION_RESERVED_METHOD_NAMES.include?(target) @@ -307,7 +313,11 @@ class Module super rescue NoMethodError if #{target}.nil? - raise DelegationError, "\#{method} delegated to #{target}, but #{target} is nil" + if #{allow_nil == true} + nil + else + raise DelegationError, "\#{method} delegated to #{target}, but #{target} is nil" + end else raise end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/deprecation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/deprecation.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/deprecation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/deprecation.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/introspection.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/introspection.rb similarity index 67% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/introspection.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/introspection.rb index aff8c2f3ce..7cdcab59b8 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/introspection.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/introspection.rb @@ -11,20 +11,12 @@ class Module if defined?(@parent_name) @parent_name else - parent_name = name =~ /::[^:]+\Z/ ? $`.freeze : nil + parent_name = name =~ /::[^:]+\z/ ? -$` : nil @parent_name = parent_name unless frozen? parent_name end end - def parent_name - ActiveSupport::Deprecation.warn(<<-MSG.squish) - `Module#parent_name` has been renamed to `module_parent_name`. - `parent_name` is deprecated and will be removed in Rails 6.1. - MSG - module_parent_name - end - # Returns the module which contains this one according to its name. # # module M @@ -44,14 +36,6 @@ class Module module_parent_name ? ActiveSupport::Inflector.constantize(module_parent_name) : Object end - def parent - ActiveSupport::Deprecation.warn(<<-MSG.squish) - `Module#parent` has been renamed to `module_parent`. - `parent` is deprecated and will be removed in Rails 6.1. - MSG - module_parent - end - # Returns all the parents of this module according to its name, ordered from # nested outwards. The receiver is not contained within the result. # @@ -76,12 +60,4 @@ class Module parents << Object unless parents.include? Object parents end - - def parents - ActiveSupport::Deprecation.warn(<<-MSG.squish) - `Module#parents` has been renamed to `module_parents`. - `parents` is deprecated and will be removed in Rails 6.1. - MSG - module_parents - end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/redefine_method.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/redefine_method.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/redefine_method.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/redefine_method.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/remove_method.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/remove_method.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/module/remove_method.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/module/remove_method.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/name_error.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/name_error.rb similarity index 54% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/name_error.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/name_error.rb index 6d37cd9dfd..15255d58b9 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/name_error.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/name_error.rb @@ -14,9 +14,22 @@ class NameError # It extends NameError#message with spell corrections which are SLOW. # We should use original_message message instead. message = respond_to?(:original_message) ? original_message : self.message + return unless message.start_with?("uninitialized constant ") - if /undefined local variable or method/ !~ message - $1 if /((::)?([A-Z]\w*)(::[A-Z]\w*)*)$/ =~ message + receiver = begin + self.receiver + rescue ArgumentError + nil + end + + if receiver == Object + name.to_s + elsif receiver + "#{real_mod_name(receiver)}::#{self.name}" + else + if match = message.match(/((::)?([A-Z]\w*)(::[A-Z]\w*)*)$/) + match[1] + end end end @@ -35,4 +48,18 @@ class NameError missing_name == name.to_s end end + + private + UNBOUND_METHOD_MODULE_NAME = Module.instance_method(:name) + private_constant :UNBOUND_METHOD_MODULE_NAME + + if UnboundMethod.method_defined?(:bind_call) + def real_mod_name(mod) + UNBOUND_METHOD_MODULE_NAME.bind_call(mod) + end + else + def real_mod_name(mod) + UNBOUND_METHOD_MODULE_NAME.bind(mod).call + end + end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/numeric.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/numeric.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/numeric.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/numeric.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/numeric/bytes.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/numeric/bytes.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/numeric/bytes.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/numeric/bytes.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/numeric/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/numeric/conversions.rb similarity index 76% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/numeric/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/numeric/conversions.rb index 8acad6164a..3e623e0d17 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/numeric/conversions.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/numeric/conversions.rb @@ -2,7 +2,6 @@ require "active_support/core_ext/big_decimal/conversions" require "active_support/number_helper" -require "active_support/core_ext/module/deprecation" module ActiveSupport module NumericWithFormat @@ -27,10 +26,11 @@ module ActiveSupport # # => "+1.123.555.1234 x 1343" # # Currency: - # 1234567890.50.to_s(:currency) # => "$1,234,567,890.50" - # 1234567890.506.to_s(:currency) # => "$1,234,567,890.51" - # 1234567890.506.to_s(:currency, precision: 3) # => "$1,234,567,890.506" - # 1234567890.506.to_s(:currency, locale: :fr) # => "1 234 567 890,51 €" + # 1234567890.50.to_s(:currency) # => "$1,234,567,890.50" + # 1234567890.506.to_s(:currency) # => "$1,234,567,890.51" + # 1234567890.506.to_s(:currency, precision: 3) # => "$1,234,567,890.506" + # 1234567890.506.to_s(:currency, round_mode: :down) # => "$1,234,567,890.50" + # 1234567890.506.to_s(:currency, locale: :fr) # => "1 234 567 890,51 €" # -1234567890.50.to_s(:currency, negative_format: '(%u%n)') # # => "($1,234,567,890.50)" # 1234567890.50.to_s(:currency, unit: '£', separator: ',', delimiter: '') @@ -43,6 +43,7 @@ module ActiveSupport # 100.to_s(:percentage, precision: 0) # => "100%" # 1000.to_s(:percentage, delimiter: '.', separator: ',') # => "1.000,000%" # 302.24398923423.to_s(:percentage, precision: 5) # => "302.24399%" + # 302.24398923423.to_s(:percentage, round_mode: :down) # => "302.243%" # 1000.to_s(:percentage, locale: :fr) # => "1 000,000%" # 100.to_s(:percentage, format: '%n %') # => "100.000 %" # @@ -59,6 +60,7 @@ module ActiveSupport # Rounded: # 111.2345.to_s(:rounded) # => "111.235" # 111.2345.to_s(:rounded, precision: 2) # => "111.23" + # 111.2345.to_s(:rounded, precision: 2, round_mode: :up) # => "111.24" # 13.to_s(:rounded, precision: 5) # => "13.00000" # 389.32314.to_s(:rounded, precision: 0) # => "389" # 111.2345.to_s(:rounded, significant: true) # => "111" @@ -72,19 +74,20 @@ module ActiveSupport # # => "1.111,23" # # Human-friendly size in Bytes: - # 123.to_s(:human_size) # => "123 Bytes" - # 1234.to_s(:human_size) # => "1.21 KB" - # 12345.to_s(:human_size) # => "12.1 KB" - # 1234567.to_s(:human_size) # => "1.18 MB" - # 1234567890.to_s(:human_size) # => "1.15 GB" - # 1234567890123.to_s(:human_size) # => "1.12 TB" - # 1234567890123456.to_s(:human_size) # => "1.1 PB" - # 1234567890123456789.to_s(:human_size) # => "1.07 EB" - # 1234567.to_s(:human_size, precision: 2) # => "1.2 MB" - # 483989.to_s(:human_size, precision: 2) # => "470 KB" - # 1234567.to_s(:human_size, precision: 2, separator: ',') # => "1,2 MB" - # 1234567890123.to_s(:human_size, precision: 5) # => "1.1228 TB" - # 524288000.to_s(:human_size, precision: 5) # => "500 MB" + # 123.to_s(:human_size) # => "123 Bytes" + # 1234.to_s(:human_size) # => "1.21 KB" + # 12345.to_s(:human_size) # => "12.1 KB" + # 1234567.to_s(:human_size) # => "1.18 MB" + # 1234567890.to_s(:human_size) # => "1.15 GB" + # 1234567890123.to_s(:human_size) # => "1.12 TB" + # 1234567890123456.to_s(:human_size) # => "1.1 PB" + # 1234567890123456789.to_s(:human_size) # => "1.07 EB" + # 1234567.to_s(:human_size, precision: 2) # => "1.2 MB" + # 1234567.to_s(:human_size, precision: 2, round_mode: :up) # => "1.3 MB" + # 483989.to_s(:human_size, precision: 2) # => "470 KB" + # 1234567.to_s(:human_size, precision: 2, separator: ',') # => "1,2 MB" + # 1234567890123.to_s(:human_size, precision: 5) # => "1.1228 TB" + # 524288000.to_s(:human_size, precision: 5) # => "500 MB" # # Human-friendly format: # 123.to_s(:human) # => "123" @@ -96,6 +99,7 @@ module ActiveSupport # 1234567890123456.to_s(:human) # => "1.23 Quadrillion" # 1234567890123456789.to_s(:human) # => "1230 Quadrillion" # 489939.to_s(:human, precision: 2) # => "490 Thousand" + # 489939.to_s(:human, precision: 2, round_mode: :down) # => "480 Thousand" # 489939.to_s(:human, precision: 4) # => "489.9 Thousand" # 1234567.to_s(:human, precision: 4, # significant: false) # => "1.2346 Million" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/numeric/time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/numeric/time.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/numeric/time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/numeric/time.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/acts_like.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/acts_like.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/acts_like.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/acts_like.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/blank.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/blank.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/blank.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/blank.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/deep_dup.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/deep_dup.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/deep_dup.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/deep_dup.rb index c66c5eb2d9..5c903917f5 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/deep_dup.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/deep_dup.rb @@ -43,7 +43,7 @@ class Hash def deep_dup hash = dup each_pair do |key, value| - if key.frozen? && ::String === key + if (::String === key && key.frozen?) || ::Symbol === key hash[key] = value.deep_dup else hash.delete(key) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/duplicable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/duplicable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/duplicable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/duplicable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/inclusion.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/inclusion.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/inclusion.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/inclusion.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/instance_variables.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/instance_variables.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/instance_variables.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/instance_variables.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/json.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/json.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/json.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/json.rb index 416059d17b..dcfbe8b40f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/json.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/json.rb @@ -45,7 +45,7 @@ module ActiveSupport end end -[Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass, Enumerable].reverse_each do |klass| +[Enumerable, Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass].reverse_each do |klass| klass.prepend(ActiveSupport::ToJsonWithActiveSupportEncoder) end @@ -169,7 +169,11 @@ class Hash self end - Hash[subset.map { |k, v| [k.to_s, options ? v.as_json(options.dup) : v.as_json] }] + result = {} + subset.each do |k, v| + result[k.to_s] = options ? v.as_json(options.dup) : v.as_json + end + result end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/to_param.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/to_param.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/to_param.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/to_param.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/to_query.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/to_query.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/to_query.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/to_query.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/try.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/try.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/try.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/try.rb index d4b13fa413..999141a993 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/try.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/try.rb @@ -145,14 +145,14 @@ class NilClass # # With +try+ # @person.try(:children).try(:first).try(:name) - def try(method_name = nil, *args) + def try(_method_name = nil, *) nil end # Calling +try!+ on +nil+ always returns +nil+. # # nil.try!(:name) # => nil - def try!(method_name = nil, *args) + def try!(_method_name = nil, *) nil end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/with_options.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/with_options.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/object/with_options.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/object/with_options.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/range.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/range.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/range.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/range.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/range/compare_range.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/range/compare_range.rb similarity index 77% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/range/compare_range.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/range/compare_range.rb index d2c85d7679..c6d5b77e8e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/range/compare_range.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/range/compare_range.rb @@ -15,11 +15,13 @@ module ActiveSupport # The given range must be fully bounded, with both start and end. def ===(value) if value.is_a?(::Range) + is_backwards_op = value.exclude_end? ? :>= : :> + return false if value.begin && value.end && value.begin.public_send(is_backwards_op, value.end) # 1...10 includes 1..9 but it does not include 1..10. # 1..10 includes 1...11 but it does not include 1...12. operator = exclude_end? && !value.exclude_end? ? :< : :<= value_max = !exclude_end? && value.exclude_end? ? value.max : value.last - super(value.first) && (self.end.nil? || value_max.send(operator, last)) + super(value.first) && (self.end.nil? || value_max.public_send(operator, last)) else super end @@ -38,11 +40,13 @@ module ActiveSupport # The given range must be fully bounded, with both start and end. def include?(value) if value.is_a?(::Range) + is_backwards_op = value.exclude_end? ? :>= : :> + return false if value.begin && value.end && value.begin.public_send(is_backwards_op, value.end) # 1...10 includes 1..9 but it does not include 1..10. # 1..10 includes 1...11 but it does not include 1...12. operator = exclude_end? && !value.exclude_end? ? :< : :<= value_max = !exclude_end? && value.exclude_end? ? value.max : value.last - super(value.first) && (self.end.nil? || value_max.send(operator, last)) + super(value.first) && (self.end.nil? || value_max.public_send(operator, last)) else super end @@ -61,11 +65,13 @@ module ActiveSupport # The given range must be fully bounded, with both start and end. def cover?(value) if value.is_a?(::Range) + is_backwards_op = value.exclude_end? ? :>= : :> + return false if value.begin && value.end && value.begin.public_send(is_backwards_op, value.end) # 1...10 covers 1..9 but it does not cover 1..10. # 1..10 covers 1...11 but it does not cover 1...12. operator = exclude_end? && !value.exclude_end? ? :< : :<= value_max = !exclude_end? && value.exclude_end? ? value.max : value.last - super(value.first) && (self.end.nil? || value_max.send(operator, last)) + super(value.first) && (self.end.nil? || value_max.public_send(operator, last)) else super end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/range/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/range/conversions.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/range/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/range/conversions.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/range/each.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/range/each.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/range/each.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/range/each.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/range/include_time_with_zone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/range/include_time_with_zone.rb similarity index 50% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/range/include_time_with_zone.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/range/include_time_with_zone.rb index 2b458717ec..89e911b11d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/range/include_time_with_zone.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/range/include_time_with_zone.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "active_support/time_with_zone" +require "active_support/deprecation" module ActiveSupport module IncludeTimeWithZone #:nodoc: @@ -9,9 +10,13 @@ module ActiveSupport # (1.hour.ago..1.hour.from_now).include?(Time.current) # => true # def include?(value) - if self.begin.is_a?(TimeWithZone) - cover?(value) - elsif self.end.is_a?(TimeWithZone) + if self.begin.is_a?(TimeWithZone) || self.end.is_a?(TimeWithZone) + ActiveSupport::Deprecation.warn(<<-MSG.squish) + Using `Range#include?` to check the inclusion of a value in + a date time range is deprecated. + It is recommended to use `Range#cover?` instead of `Range#include?` to + check the inclusion of a value in a date time range. + MSG cover?(value) else super diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/range/overlaps.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/range/overlaps.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/range/overlaps.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/range/overlaps.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/regexp.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/regexp.rb new file mode 100644 index 0000000000..15534ff52f --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/regexp.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class Regexp + # Returns +true+ if the regexp has the multiline flag set. + # + # (/./).multiline? # => false + # (/./m).multiline? # => true + # + # Regexp.new(".").multiline? # => false + # Regexp.new(".", Regexp::MULTILINE).multiline? # => true + def multiline? + options & MULTILINE == MULTILINE + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/securerandom.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/securerandom.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/securerandom.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/securerandom.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/access.rb similarity index 83% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/access.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/access.rb index 4ca24028b0..f6a14c08bc 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/access.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/access.rb @@ -44,7 +44,7 @@ class String # str.from(0).to(-1) # => "hello" # str.from(1).to(-2) # => "ell" def from(position) - self[position..-1] + self[position, length] end # Returns a substring from the beginning of the string to the given position. @@ -61,7 +61,8 @@ class String # str.from(0).to(-1) # => "hello" # str.from(1).to(-2) # => "ell" def to(position) - self[0..position] + position += size if position < 0 + self[0, position + 1] || +"" end # Returns the first character. If a limit is supplied, returns a substring @@ -75,17 +76,7 @@ class String # str.first(0) # => "" # str.first(6) # => "hello" def first(limit = 1) - ActiveSupport::Deprecation.warn( - "Calling String#first with a negative integer limit " \ - "will raise an ArgumentError in Rails 6.1." - ) if limit < 0 - if limit == 0 - "" - elsif limit >= size - dup - else - to(limit - 1) - end + self[0, limit] || raise(ArgumentError, "negative limit") end # Returns the last character of the string. If a limit is supplied, returns a substring @@ -99,16 +90,6 @@ class String # str.last(0) # => "" # str.last(6) # => "hello" def last(limit = 1) - ActiveSupport::Deprecation.warn( - "Calling String#last with a negative integer limit " \ - "will raise an ArgumentError in Rails 6.1." - ) if limit < 0 - if limit == 0 - "" - elsif limit >= size - dup - else - from(-limit) - end + self[[length - limit, 0].max, limit] || raise(ArgumentError, "negative limit") end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/behavior.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/behavior.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/behavior.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/behavior.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/conversions.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/conversions.rb index 29a88b07ad..e84a3909a1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/conversions.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/conversions.rb @@ -18,6 +18,7 @@ class String # "2012-12-13T06:12".to_time # => 2012-12-13 06:12:00 +0100 # "2012-12-13T06:12".to_time(:utc) # => 2012-12-13 06:12:00 UTC # "12/13/2012".to_time # => ArgumentError: argument out of range + # "1604326192".to_time # => ArgumentError: argument out of range def to_time(form = :local) parts = Date._parse(self, false) used_keys = %i(year mon mday hour min sec sec_fraction offset) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/exclude.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/exclude.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/exclude.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/exclude.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/filters.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/filters.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/filters.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/filters.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/indent.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/indent.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/indent.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/indent.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/inflections.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/inflections.rb similarity index 91% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/inflections.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/inflections.rb index 5eb8d9f99b..9bf465bda3 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/inflections.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/inflections.rb @@ -30,6 +30,8 @@ class String # 'apple'.pluralize(2) # => "apples" # 'ley'.pluralize(:es) # => "leyes" # 'ley'.pluralize(1, :es) # => "ley" + # + # See ActiveSupport::Inflector.pluralize. def pluralize(count = nil, locale = :en) locale = count if count.is_a?(Symbol) if count == 1 @@ -53,28 +55,34 @@ class String # 'the blue mailmen'.singularize # => "the blue mailman" # 'CamelOctopi'.singularize # => "CamelOctopus" # 'leyes'.singularize(:es) # => "ley" + # + # See ActiveSupport::Inflector.singularize. def singularize(locale = :en) ActiveSupport::Inflector.singularize(self, locale) end # +constantize+ tries to find a declared constant with the name specified # in the string. It raises a NameError when the name is not in CamelCase - # or is not initialized. See ActiveSupport::Inflector.constantize + # or is not initialized. # # 'Module'.constantize # => Module # 'Class'.constantize # => Class # 'blargle'.constantize # => NameError: wrong constant name blargle + # + # See ActiveSupport::Inflector.constantize. def constantize ActiveSupport::Inflector.constantize(self) end # +safe_constantize+ tries to find a declared constant with the name specified # in the string. It returns +nil+ when the name is not in CamelCase - # or is not initialized. See ActiveSupport::Inflector.safe_constantize + # or is not initialized. # # 'Module'.safe_constantize # => Module # 'Class'.safe_constantize # => Class # 'blargle'.safe_constantize # => nil + # + # See ActiveSupport::Inflector.safe_constantize. def safe_constantize ActiveSupport::Inflector.safe_constantize(self) end @@ -88,6 +96,10 @@ class String # 'active_record'.camelize(:lower) # => "activeRecord" # 'active_record/errors'.camelize # => "ActiveRecord::Errors" # 'active_record/errors'.camelize(:lower) # => "activeRecord::Errors" + # + # +camelize+ is also aliased as +camelcase+. + # + # See ActiveSupport::Inflector.camelize. def camelize(first_letter = :upper) case first_letter when :upper @@ -108,11 +120,13 @@ class String # optional parameter +keep_id_suffix+ to true. # By default, this parameter is false. # - # +titleize+ is also aliased as +titlecase+. - # # 'man from the boondocks'.titleize # => "Man From The Boondocks" # 'x-men: the last stand'.titleize # => "X Men: The Last Stand" # 'string_ending_with_id'.titleize(keep_id_suffix: true) # => "String Ending With Id" + # + # +titleize+ is also aliased as +titlecase+. + # + # See ActiveSupport::Inflector.titleize. def titleize(keep_id_suffix: false) ActiveSupport::Inflector.titleize(self, keep_id_suffix: keep_id_suffix) end @@ -124,6 +138,8 @@ class String # # 'ActiveModel'.underscore # => "active_model" # 'ActiveModel::Errors'.underscore # => "active_model/errors" + # + # See ActiveSupport::Inflector.underscore. def underscore ActiveSupport::Inflector.underscore(self) end @@ -131,6 +147,8 @@ class String # Replaces underscores with dashes in the string. # # 'puni_puni'.dasherize # => "puni-puni" + # + # See ActiveSupport::Inflector.dasherize. def dasherize ActiveSupport::Inflector.dasherize(self) end @@ -142,6 +160,8 @@ class String # '::Inflections'.demodulize # => "Inflections" # ''.demodulize # => '' # + # See ActiveSupport::Inflector.demodulize. + # # See also +deconstantize+. def demodulize ActiveSupport::Inflector.demodulize(self) @@ -155,6 +175,8 @@ class String # '::String'.deconstantize # => "" # ''.deconstantize # => "" # + # See ActiveSupport::Inflector.deconstantize. + # # See also +demodulize+. def deconstantize ActiveSupport::Inflector.deconstantize(self) @@ -192,6 +214,8 @@ class String # # <%= link_to(@person.name, person_path) %> # # => Donald E. Knuth + # + # See ActiveSupport::Inflector.parameterize. def parameterize(separator: "-", preserve_case: false, locale: nil) ActiveSupport::Inflector.parameterize(self, separator: separator, preserve_case: preserve_case, locale: locale) end @@ -202,6 +226,8 @@ class String # 'RawScaledScorer'.tableize # => "raw_scaled_scorers" # 'ham_and_egg'.tableize # => "ham_and_eggs" # 'fancyCategory'.tableize # => "fancy_categories" + # + # See ActiveSupport::Inflector.tableize. def tableize ActiveSupport::Inflector.tableize(self) end @@ -212,6 +238,8 @@ class String # # 'ham_and_eggs'.classify # => "HamAndEgg" # 'posts'.classify # => "Post" + # + # See ActiveSupport::Inflector.classify. def classify ActiveSupport::Inflector.classify(self) end @@ -233,6 +261,8 @@ class String # 'author_id'.humanize(capitalize: false) # => "author" # '_id'.humanize # => "Id" # 'author_id'.humanize(keep_id_suffix: true) # => "Author Id" + # + # See ActiveSupport::Inflector.humanize. def humanize(capitalize: true, keep_id_suffix: false) ActiveSupport::Inflector.humanize(self, capitalize: capitalize, keep_id_suffix: keep_id_suffix) end @@ -242,6 +272,8 @@ class String # 'what a Lovely Day'.upcase_first # => "What a Lovely Day" # 'w'.upcase_first # => "W" # ''.upcase_first # => "" + # + # See ActiveSupport::Inflector.upcase_first. def upcase_first ActiveSupport::Inflector.upcase_first(self) end @@ -253,6 +285,8 @@ class String # 'Message'.foreign_key # => "message_id" # 'Message'.foreign_key(false) # => "messageid" # 'Admin::Post'.foreign_key # => "post_id" + # + # See ActiveSupport::Inflector.foreign_key. def foreign_key(separate_class_name_and_id_with_underscore = true) ActiveSupport::Inflector.foreign_key(self, separate_class_name_and_id_with_underscore) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/inquiry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/inquiry.rb similarity index 89% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/inquiry.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/inquiry.rb index a796d5fb4f..d78ad9b741 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/inquiry.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/inquiry.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "active_support/string_inquirer" +require "active_support/environment_inquirer" class String # Wraps the current string in the ActiveSupport::StringInquirer class, diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/multibyte.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/multibyte.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/multibyte.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/multibyte.rb index 6cceb46507..0542121e39 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/multibyte.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/multibyte.rb @@ -47,9 +47,9 @@ class String # iso_str.is_utf8? # => false def is_utf8? case encoding - when Encoding::UTF_8 + when Encoding::UTF_8, Encoding::US_ASCII valid_encoding? - when Encoding::ASCII_8BIT, Encoding::US_ASCII + when Encoding::ASCII_8BIT dup.force_encoding(Encoding::UTF_8).valid_encoding? else false diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/output_safety.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/output_safety.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/output_safety.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/output_safety.rb index e226779422..b83d56ca1d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/output_safety.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/output_safety.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require "erb" -require "active_support/core_ext/kernel/singleton_class" require "active_support/core_ext/module/redefine_method" require "active_support/multibyte/unicode" @@ -135,7 +134,7 @@ module ActiveSupport #:nodoc: class SafeBuffer < String UNSAFE_STRING_METHODS = %w( capitalize chomp chop delete delete_prefix delete_suffix - downcase lstrip next reverse rstrip slice squeeze strip + downcase lstrip next reverse rstrip scrub slice squeeze strip succ swapcase tr tr_s unicode_normalize upcase ) @@ -153,12 +152,12 @@ module ActiveSupport #:nodoc: def [](*args) if html_safe? - new_safe_buffer = super + new_string = super - if new_safe_buffer - new_safe_buffer.instance_variable_set :@html_safe, true - end + return unless new_string + new_safe_buffer = new_string.is_a?(SafeBuffer) ? new_string : SafeBuffer.new(new_string) + new_safe_buffer.instance_variable_set :@html_safe, true new_safe_buffer else to_str[*args] @@ -202,7 +201,7 @@ module ActiveSupport #:nodoc: end def []=(*args) - if args.count == 3 + if args.length == 3 super(args[0], args[1], html_escape_interpolated_argument(args[2])) else super(args[0], html_escape_interpolated_argument(args[1])) @@ -214,7 +213,8 @@ module ActiveSupport #:nodoc: end def *(*) - new_safe_buffer = super + new_string = super + new_safe_buffer = new_string.is_a?(SafeBuffer) ? new_string : SafeBuffer.new(new_string) new_safe_buffer.instance_variable_set(:@html_safe, @html_safe) new_safe_buffer end @@ -222,7 +222,7 @@ module ActiveSupport #:nodoc: def %(args) case args when Hash - escaped_args = Hash[args.map { |k, arg| [k, html_escape_interpolated_argument(arg)] }] + escaped_args = args.transform_values { |arg| html_escape_interpolated_argument(arg) } else escaped_args = Array(args).map { |arg| html_escape_interpolated_argument(arg) } end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/starts_ends_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/starts_ends_with.rb new file mode 100644 index 0000000000..1e216370e4 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/starts_ends_with.rb @@ -0,0 +1,6 @@ +# frozen_string_literal: true + +class String + alias :starts_with? :start_with? + alias :ends_with? :end_with? +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/strip.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/strip.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/strip.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/strip.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/zones.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/zones.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/string/zones.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/string/zones.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/symbol.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/symbol.rb new file mode 100644 index 0000000000..709fed2024 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/symbol.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require "active_support/core_ext/symbol/starts_ends_with" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/symbol/starts_ends_with.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/symbol/starts_ends_with.rb new file mode 100644 index 0000000000..655a539403 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/symbol/starts_ends_with.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class Symbol + def start_with?(*prefixes) + to_s.start_with?(*prefixes) + end unless method_defined?(:start_with?) + + def end_with?(*suffixes) + to_s.end_with?(*suffixes) + end unless method_defined?(:end_with?) + + alias :starts_with? :start_with? + alias :ends_with? :end_with? +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/time.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/time.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/time/acts_like.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/time/acts_like.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/time/acts_like.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/time/acts_like.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/time/calculations.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/time/calculations.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/time/calculations.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/time/calculations.rb index eed34965e3..9c9f26047f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/time/calculations.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/time/calculations.rb @@ -6,6 +6,7 @@ require "active_support/time_with_zone" require "active_support/core_ext/time/zones" require "active_support/core_ext/date_and_time/calculations" require "active_support/core_ext/date/calculations" +require "active_support/core_ext/module/remove_method" class Time include DateAndTime::Calculations @@ -47,7 +48,9 @@ class Time # Time.at can be called with a time or numerical value time_or_number = args.first - if time_or_number.is_a?(ActiveSupport::TimeWithZone) || time_or_number.is_a?(DateTime) + if time_or_number.is_a?(ActiveSupport::TimeWithZone) + at_without_coercion(time_or_number.to_r).getlocal + elsif time_or_number.is_a?(DateTime) at_without_coercion(time_or_number.to_f).getlocal else at_without_coercion(time_or_number) @@ -105,6 +108,21 @@ class Time subsec end + unless Time.method_defined?(:floor) + def floor(precision = 0) + change(nsec: 0) + subsec.floor(precision) + end + end + + # Restricted Ruby version due to a bug in `Time#ceil` + # See https://bugs.ruby-lang.org/issues/17025 for more details + if RUBY_VERSION <= "2.8" + remove_possible_method :ceil + def ceil(precision = 0) + change(nsec: 0) + subsec.ceil(precision) + end + end + # Returns a new Time where one or more of the elements have been changed according # to the +options+ parameter. The time options (:hour, :min, # :sec, :usec, :nsec) reset cascadingly, so if only diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/time/compatibility.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/time/compatibility.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/time/compatibility.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/time/compatibility.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/time/conversions.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/time/conversions.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/time/conversions.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/time/conversions.rb index 345cb2832c..06a494d9a5 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/time/conversions.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/time/conversions.rb @@ -6,6 +6,7 @@ require "active_support/values/time_zone" class Time DATE_FORMATS = { db: "%Y-%m-%d %H:%M:%S", + inspect: "%Y-%m-%d %H:%M:%S.%9N %z", number: "%Y%m%d%H%M%S", nsec: "%Y%m%d%H%M%S%9N", usec: "%Y%m%d%H%M%S%6N", diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/time/zones.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/time/zones.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/time/zones.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/time/zones.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/uri.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/uri.rb similarity index 76% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/uri.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/uri.rb index cdd81ae562..1cb36f9f2e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/core_ext/uri.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/core_ext/uri.rb @@ -19,7 +19,11 @@ end module URI class << self def parser - @parser ||= URI::Parser.new + ActiveSupport::Deprecation.warn(<<-MSG.squish) + URI.parser is deprecated and will be removed in Rails 6.2. + Use `URI::DEFAULT_PARSER` instead. + MSG + URI::DEFAULT_PARSER end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/current_attributes.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/current_attributes.rb similarity index 96% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/current_attributes.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/current_attributes.rb index 67ebe102d7..d2d16b2629 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/current_attributes.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/current_attributes.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "active_support/callbacks" +require "active_support/core_ext/enumerable" module ActiveSupport # Abstract super class that provides a thread-isolated attributes singleton, which resets automatically @@ -91,7 +92,7 @@ module ActiveSupport class << self # Returns singleton instance for this class in this thread. If none exists, one is created. def instance - current_instances[name] ||= new + current_instances[current_instances_key] ||= new end # Declares one or more attributes that will be given both class and instance accessor methods. @@ -150,6 +151,10 @@ module ActiveSupport Thread.current[:current_attributes_instances] ||= {} end + def current_instances_key + @current_instances_key ||= name.to_sym + end + def method_missing(name, *args, &block) # Caches the method definition as a singleton method of the receiver. # @@ -197,7 +202,7 @@ module ActiveSupport end def compute_attributes(keys) - keys.collect { |key| [ key, public_send(key) ] }.to_h + keys.index_with { |key| public_send(key) } end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/current_attributes/test_helper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/current_attributes/test_helper.rb new file mode 100644 index 0000000000..2016384a80 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/current_attributes/test_helper.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +module ActiveSupport::CurrentAttributes::TestHelper # :nodoc: + def before_setup + ActiveSupport::CurrentAttributes.reset_all + super + end + + def after_teardown + super + ActiveSupport::CurrentAttributes.reset_all + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/deprecation.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation.rb similarity index 84% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/deprecation.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation.rb index 7271ab565b..006e404cab 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/deprecation.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation.rb @@ -17,15 +17,18 @@ module ActiveSupport require "active_support/deprecation/instance_delegator" require "active_support/deprecation/behaviors" require "active_support/deprecation/reporting" + require "active_support/deprecation/disallowed" require "active_support/deprecation/constant_accessor" require "active_support/deprecation/method_wrappers" require "active_support/deprecation/proxy_wrappers" require "active_support/core_ext/module/deprecation" + require "concurrent/atomic/thread_local_var" include Singleton include InstanceDelegator include Behavior include Reporting + include Disallowed include MethodWrapper # The version number in which the deprecated behavior will be removed, by default. @@ -35,12 +38,14 @@ module ActiveSupport # and the second is a library name. # # ActiveSupport::Deprecation.new('2.0', 'MyLibrary') - def initialize(deprecation_horizon = "6.1", gem_name = "Rails") + def initialize(deprecation_horizon = "6.2", gem_name = "Rails") self.gem_name = gem_name self.deprecation_horizon = deprecation_horizon # By default, warnings are not silenced and debugging is off. self.silenced = false self.debug = false + @silenced_thread = Concurrent::ThreadLocalVar.new(false) + @explicitly_allowed_warnings = Concurrent::ThreadLocalVar.new(nil) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/deprecation/behaviors.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/behaviors.rb similarity index 84% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/deprecation/behaviors.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/behaviors.rb index 725667d139..9d1fc78360 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/deprecation/behaviors.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/behaviors.rb @@ -51,7 +51,7 @@ module ActiveSupport # constant. Available behaviors are: # # [+raise+] Raise ActiveSupport::DeprecationException. - # [+stderr+] Log all deprecation warnings to +$stderr+. + # [+stderr+] Log all deprecation warnings to $stderr. # [+log+] Log all deprecation warnings to +Rails.logger+. # [+notify+] Use +ActiveSupport::Notifications+ to notify +deprecation.rails+. # [+silence+] Do nothing. @@ -67,13 +67,18 @@ module ActiveSupport @behavior ||= [DEFAULT_BEHAVIORS[:stderr]] end + # Returns the current behavior for disallowed deprecations or if one isn't set, defaults to +:raise+. + def disallowed_behavior + @disallowed_behavior ||= [DEFAULT_BEHAVIORS[:raise]] + end + # Sets the behavior to the specified value. Can be a single value, array, # or an object that responds to +call+. # # Available behaviors: # # [+raise+] Raise ActiveSupport::DeprecationException. - # [+stderr+] Log all deprecation warnings to +$stderr+. + # [+stderr+] Log all deprecation warnings to $stderr. # [+log+] Log all deprecation warnings to +Rails.logger+. # [+notify+] Use +ActiveSupport::Notifications+ to notify +deprecation.rails+. # [+silence+] Do nothing. @@ -92,6 +97,14 @@ module ActiveSupport @behavior = Array(behavior).map { |b| DEFAULT_BEHAVIORS[b] || arity_coerce(b) } end + # Sets the behavior for disallowed deprecations (those configured by + # ActiveSupport::Deprecation.disallowed_warnings=) to the specified + # value. As with +behavior=+, this can be a single value, array, or an + # object that responds to +call+. + def disallowed_behavior=(behavior) + @disallowed_behavior = Array(behavior).map { |b| DEFAULT_BEHAVIORS[b] || arity_coerce(b) } + end + private def arity_coerce(behavior) unless behavior.respond_to?(:call) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/deprecation/constant_accessor.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/constant_accessor.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/deprecation/constant_accessor.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/constant_accessor.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/disallowed.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/disallowed.rb new file mode 100644 index 0000000000..096ecaae85 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/disallowed.rb @@ -0,0 +1,56 @@ +# frozen_string_literal: true + +module ActiveSupport + class Deprecation + module Disallowed + # Sets the criteria used to identify deprecation messages which should be + # disallowed. Can be an array containing strings, symbols, or regular + # expressions. (Symbols are treated as strings). These are compared against + # the text of the generated deprecation warning. + # + # Additionally the scalar symbol +:all+ may be used to treat all + # deprecations as disallowed. + # + # Deprecations matching a substring or regular expression will be handled + # using the configured +ActiveSupport::Deprecation.disallowed_behavior+ + # rather than +ActiveSupport::Deprecation.behavior+ + attr_writer :disallowed_warnings + + # Returns the configured criteria used to identify deprecation messages + # which should be treated as disallowed. + def disallowed_warnings + @disallowed_warnings ||= [] + end + + private + def deprecation_disallowed?(message) + disallowed = ActiveSupport::Deprecation.disallowed_warnings + return false if explicitly_allowed?(message) + return true if disallowed == :all + disallowed.any? do |rule| + case rule + when String, Symbol + message.include?(rule.to_s) + when Regexp + rule.match?(message) + end + end + end + + def explicitly_allowed?(message) + allowances = @explicitly_allowed_warnings.value + return false unless allowances + return true if allowances == :all + allowances = [allowances] unless allowances.kind_of?(Array) + allowances.any? do |rule| + case rule + when String, Symbol + message.include?(rule.to_s) + when Regexp + rule.match?(message) + end + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/deprecation/instance_delegator.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/instance_delegator.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/deprecation/instance_delegator.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/instance_delegator.rb index 8beda373a2..59dd30ae30 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/deprecation/instance_delegator.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/instance_delegator.rb @@ -1,6 +1,5 @@ # frozen_string_literal: true -require "active_support/core_ext/kernel/singleton_class" require "active_support/core_ext/module/delegation" module ActiveSupport diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/deprecation/method_wrappers.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/method_wrappers.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/deprecation/method_wrappers.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/method_wrappers.rb index bc202ff2e4..e6cf28a89f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/deprecation/method_wrappers.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/method_wrappers.rb @@ -56,11 +56,12 @@ module ActiveSupport mod = nil method_names.each do |method_name| + message = options[method_name] if target_module.method_defined?(method_name) || target_module.private_method_defined?(method_name) method = target_module.instance_method(method_name) target_module.module_eval do redefine_method(method_name) do |*args, &block| - deprecator.deprecation_warning(method_name, options[method_name]) + deprecator.deprecation_warning(method_name, message) method.bind(self).call(*args, &block) end ruby2_keywords(method_name) if respond_to?(:ruby2_keywords, true) @@ -69,7 +70,7 @@ module ActiveSupport mod ||= Module.new mod.module_eval do define_method(method_name) do |*args, &block| - deprecator.deprecation_warning(method_name, options[method_name]) + deprecator.deprecation_warning(method_name, message) super(*args, &block) end ruby2_keywords(method_name) if respond_to?(:ruby2_keywords, true) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/deprecation/proxy_wrappers.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/proxy_wrappers.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/deprecation/proxy_wrappers.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/proxy_wrappers.rb index b6b32e2025..4bc112d6c4 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/deprecation/proxy_wrappers.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/proxy_wrappers.rb @@ -121,7 +121,7 @@ module ActiveSupport # (Backtrace information…) # ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune"] class DeprecatedConstantProxy < Module - def self.new(*args, **kwargs, &block) + def self.new(*args, **options, &block) object = args.first return object unless object @@ -129,7 +129,7 @@ module ActiveSupport end def initialize(old_const, new_const, deprecator = ActiveSupport::Deprecation.instance, message: "#{old_const} is deprecated! Use #{new_const} instead.") - require "active_support/inflector/methods" + Kernel.require "active_support/inflector/methods" @old_const = old_const @new_const = new_const @@ -147,7 +147,7 @@ module ActiveSupport # Don't give a deprecation warning on methods that IRB may invoke # during tab-completion. - delegate :hash, :instance_methods, :name, to: :target + delegate :hash, :instance_methods, :name, :respond_to?, to: :target # Returns the class of the new constant. # diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/deprecation/reporting.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/reporting.rb similarity index 64% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/deprecation/reporting.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/reporting.rb index 7075b5b869..51514eb3a6 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/deprecation/reporting.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/deprecation/reporting.rb @@ -6,7 +6,7 @@ module ActiveSupport class Deprecation module Reporting # Whether to print a message (silent mode) - attr_accessor :silenced + attr_writer :silenced # Name of gem where method is deprecated attr_accessor :gem_name @@ -20,7 +20,11 @@ module ActiveSupport callstack ||= caller_locations(2) deprecation_message(callstack, message).tap do |m| - behavior.each { |b| b.call(m, callstack, deprecation_horizon, gem_name) } + if deprecation_disallowed?(message) + disallowed_behavior.each { |b| b.call(m, callstack, deprecation_horizon, gem_name) } + else + behavior.each { |b| b.call(m, callstack, deprecation_horizon, gem_name) } + end end end @@ -33,11 +37,50 @@ module ActiveSupport # ActiveSupport::Deprecation.warn('something broke!') # end # # => nil - def silence - old_silenced, @silenced = @silenced, true - yield - ensure - @silenced = old_silenced + def silence(&block) + @silenced_thread.bind(true, &block) + end + + # Allow previously disallowed deprecation warnings within the block. + # allowed_warnings can be an array containing strings, symbols, or regular + # expressions. (Symbols are treated as strings). These are compared against + # the text of deprecation warning messages generated within the block. + # Matching warnings will be exempt from the rules set by + # +ActiveSupport::Deprecation.disallowed_warnings+ + # + # The optional if: argument accepts a truthy/falsy value or an object that + # responds to .call. If truthy, then matching warnings will be allowed. + # If falsey then the method yields to the block without allowing the warning. + # + # ActiveSupport::Deprecation.disallowed_behavior = :raise + # ActiveSupport::Deprecation.disallowed_warnings = [ + # "something broke" + # ] + # + # ActiveSupport::Deprecation.warn('something broke!') + # # => ActiveSupport::DeprecationException + # + # ActiveSupport::Deprecation.allow ['something broke'] do + # ActiveSupport::Deprecation.warn('something broke!') + # end + # # => nil + # + # ActiveSupport::Deprecation.allow ['something broke'], if: Rails.env.production? do + # ActiveSupport::Deprecation.warn('something broke!') + # end + # # => ActiveSupport::DeprecationException for dev/test, nil for production + def allow(allowed_warnings = :all, if: true, &block) + conditional = binding.local_variable_get(:if) + conditional = conditional.call if conditional.respond_to?(:call) + if conditional + @explicitly_allowed_warnings.bind(allowed_warnings, &block) + else + yield + end + end + + def silenced + @silenced || @silenced_thread.value end def deprecation_warning(deprecated_method_name, message = nil, caller_backtrace = nil) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/descendants_tracker.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/descendants_tracker.rb similarity index 93% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/descendants_tracker.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/descendants_tracker.rb index 1dad4f923e..2362914dce 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/descendants_tracker.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/descendants_tracker.rb @@ -13,6 +13,7 @@ module ActiveSupport descendants = @@direct_descendants[klass] descendants ? descendants.to_a : [] end + alias_method :subclasses, :direct_descendants def descendants(klass) arr = [] @@ -59,6 +60,7 @@ module ActiveSupport def direct_descendants DescendantsTracker.direct_descendants(self) end + alias_method :subclasses, :direct_descendants def descendants DescendantsTracker.descendants(self) @@ -77,15 +79,17 @@ module ActiveSupport end def <<(klass) - cleanup! @refs << WeakRef.new(klass) end def each - @refs.each do |ref| + @refs.reject! do |ref| yield ref.__getobj__ + false rescue WeakRef::RefError + true end + self end def refs_size diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/digest.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/digest.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/digest.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/digest.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/duration.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/duration.rb similarity index 81% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/duration.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/duration.rb index f1f5253115..850d647d33 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/duration.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/duration.rb @@ -39,7 +39,7 @@ module ActiveSupport def +(other) if Duration === other - seconds = value + other.parts[:seconds] + seconds = value + other.parts.fetch(:seconds, 0) new_parts = other.parts.merge(seconds: seconds) new_value = value + other.value @@ -51,8 +51,8 @@ module ActiveSupport def -(other) if Duration === other - seconds = value - other.parts[:seconds] - new_parts = other.parts.map { |part, other_value| [part, -other_value] }.to_h + seconds = value - other.parts.fetch(:seconds, 0) + new_parts = other.parts.transform_values(&:-@) new_parts = new_parts.merge(seconds: seconds) new_value = value - other.value @@ -64,7 +64,7 @@ module ActiveSupport def *(other) if Duration === other - new_parts = other.parts.map { |part, other_value| [part, value * other_value] }.to_h + new_parts = other.parts.transform_values { |other_value| value * other_value } new_value = value * other.value Duration.new(new_value, new_parts) @@ -147,31 +147,31 @@ module ActiveSupport end def seconds(value) #:nodoc: - new(value, [[:seconds, value]]) + new(value, seconds: value) end def minutes(value) #:nodoc: - new(value * SECONDS_PER_MINUTE, [[:minutes, value]]) + new(value * SECONDS_PER_MINUTE, minutes: value) end def hours(value) #:nodoc: - new(value * SECONDS_PER_HOUR, [[:hours, value]]) + new(value * SECONDS_PER_HOUR, hours: value) end def days(value) #:nodoc: - new(value * SECONDS_PER_DAY, [[:days, value]]) + new(value * SECONDS_PER_DAY, days: value) end def weeks(value) #:nodoc: - new(value * SECONDS_PER_WEEK, [[:weeks, value]]) + new(value * SECONDS_PER_WEEK, weeks: value) end def months(value) #:nodoc: - new(value * SECONDS_PER_MONTH, [[:months, value]]) + new(value * SECONDS_PER_MONTH, months: value) end def years(value) #:nodoc: - new(value * SECONDS_PER_YEAR, [[:years, value]]) + new(value * SECONDS_PER_YEAR, years: value) end # Creates a new Duration from a seconds value that is converted @@ -181,6 +181,10 @@ module ActiveSupport # ActiveSupport::Duration.build(2716146).parts # => {:months=>1, :days=>1} # def build(value) + unless value.is_a?(::Numeric) + raise TypeError, "can't build an #{self.name} from a #{value.class.name}" + end + parts = {} remainder = value.round(9) @@ -206,8 +210,7 @@ module ActiveSupport end def initialize(value, parts) #:nodoc: - @value, @parts = value, parts.to_h - @parts.default = 0 + @value, @parts = value, parts @parts.reject! { |k, v| v.zero? } unless value == 0 end @@ -236,13 +239,12 @@ module ActiveSupport # are treated as seconds. def +(other) if Duration === other - parts = @parts.dup - other.parts.each do |(key, value)| - parts[key] += value + parts = @parts.merge(other.parts) do |_key, value, other_value| + value + other_value end Duration.new(value + other.value, parts) else - seconds = @parts[:seconds] + other + seconds = @parts.fetch(:seconds, 0) + other Duration.new(value + other, @parts.merge(seconds: seconds)) end end @@ -256,9 +258,9 @@ module ActiveSupport # Multiplies this Duration by a Numeric and returns a new Duration. def *(other) if Scalar === other || Duration === other - Duration.new(value * other.value, parts.map { |type, number| [type, number * other.value] }) + Duration.new(value * other.value, parts.transform_values { |number| number * other.value }) elsif Numeric === other - Duration.new(value * other, parts.map { |type, number| [type, number * other] }) + Duration.new(value * other, parts.transform_values { |number| number * other }) else raise_type_error(other) end @@ -267,11 +269,11 @@ module ActiveSupport # Divides this Duration by a Numeric and returns a new Duration. def /(other) if Scalar === other - Duration.new(value / other.value, parts.map { |type, number| [type, number / other.value] }) + Duration.new(value / other.value, parts.transform_values { |number| number / other.value }) elsif Duration === other value / other.value elsif Numeric === other - Duration.new(value / other, parts.map { |type, number| [type, number / other] }) + Duration.new(value / other, parts.transform_values { |number| number / other }) else raise_type_error(other) end @@ -290,7 +292,11 @@ module ActiveSupport end def -@ #:nodoc: - Duration.new(-value, parts.map { |type, number| [type, -number] }) + Duration.new(-value, parts.transform_values(&:-@)) + end + + def +@ #:nodoc: + self end def is_a?(klass) #:nodoc: @@ -343,6 +349,49 @@ module ActiveSupport def to_i @value.to_i end + alias :in_seconds :to_i + + # Returns the amount of minutes a duration covers as a float + # + # 1.day.in_minutes # => 1440.0 + def in_minutes + in_seconds / SECONDS_PER_MINUTE.to_f + end + + # Returns the amount of hours a duration covers as a float + # + # 1.day.in_hours # => 24.0 + def in_hours + in_seconds / SECONDS_PER_HOUR.to_f + end + + # Returns the amount of days a duration covers as a float + # + # 12.hours.in_days # => 0.5 + def in_days + in_seconds / SECONDS_PER_DAY.to_f + end + + # Returns the amount of weeks a duration covers as a float + # + # 2.months.in_weeks # => 8.696 + def in_weeks + in_seconds / SECONDS_PER_WEEK.to_f + end + + # Returns the amount of months a duration covers as a float + # + # 9.weeks.in_months # => 2.07 + def in_months + in_seconds / SECONDS_PER_MONTH.to_f + end + + # Returns the amount of years a duration covers as a float + # + # 30.days.in_years # => 0.082 + def in_years + in_seconds / SECONDS_PER_YEAR.to_f + end # Returns +true+ if +other+ is also a Duration instance, which has the # same parts as this one. diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/encrypted_configuration.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/encrypted_configuration.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/encrypted_configuration.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/encrypted_configuration.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/encrypted_file.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/encrypted_file.rb similarity index 76% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/encrypted_file.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/encrypted_file.rb index 544dacb7e5..a35cc54ef5 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/encrypted_file.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/encrypted_file.rb @@ -20,17 +20,28 @@ module ActiveSupport end end + class InvalidKeyLengthError < RuntimeError + def initialize + super "Encryption key must be exactly #{EncryptedFile.expected_key_length} characters." + end + end + CIPHER = "aes-128-gcm" def self.generate_key SecureRandom.hex(ActiveSupport::MessageEncryptor.key_len(CIPHER)) end + def self.expected_key_length # :nodoc: + @expected_key_length ||= generate_key.length + end + attr_reader :content_path, :key_path, :env_key, :raise_if_missing_key def initialize(content_path:, key_path:, env_key:, raise_if_missing_key:) - @content_path, @key_path = Pathname.new(content_path), Pathname.new(key_path) + @content_path = Pathname.new(content_path).yield_self { |path| path.symlink? ? path.realpath : path } + @key_path = Pathname.new(key_path) @env_key, @raise_if_missing_key = env_key, raise_if_missing_key end @@ -73,6 +84,7 @@ module ActiveSupport def encrypt(contents) + check_key_length encryptor.encrypt_and_sign contents end @@ -90,11 +102,16 @@ module ActiveSupport end def read_key_file - key_path.binread.strip if key_path.exist? + return @key_file_contents if defined?(@key_file_contents) + @key_file_contents = (key_path.binread.strip if key_path.exist?) end def handle_missing_key raise MissingKeyError.new(key_path: key_path, env_key: env_key) if raise_if_missing_key end + + def check_key_length + raise InvalidKeyLengthError if key&.length != self.class.expected_key_length + end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/environment_inquirer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/environment_inquirer.rb new file mode 100644 index 0000000000..05361d9327 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/environment_inquirer.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +require "active_support/string_inquirer" + +module ActiveSupport + class EnvironmentInquirer < StringInquirer #:nodoc: + DEFAULT_ENVIRONMENTS = ["development", "test", "production"] + def initialize(env) + super(env) + + DEFAULT_ENVIRONMENTS.each do |default| + instance_variable_set :"@#{default}", env == default + end + end + + DEFAULT_ENVIRONMENTS.each do |env| + class_eval "def #{env}?; @#{env}; end" + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/evented_file_update_checker.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/evented_file_update_checker.rb new file mode 100644 index 0000000000..f9bc3be9be --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/evented_file_update_checker.rb @@ -0,0 +1,170 @@ +# frozen_string_literal: true + +require "set" +require "pathname" +require "concurrent/atomic/atomic_boolean" +require "listen" +require "active_support/fork_tracker" + +module ActiveSupport + # Allows you to "listen" to changes in a file system. + # The evented file updater does not hit disk when checking for updates + # instead it uses platform specific file system events to trigger a change + # in state. + # + # The file checker takes an array of files to watch or a hash specifying directories + # and file extensions to watch. It also takes a block that is called when + # EventedFileUpdateChecker#execute is run or when EventedFileUpdateChecker#execute_if_updated + # is run and there have been changes to the file system. + # + # Note: Forking will cause the first call to `updated?` to return `true`. + # + # Example: + # + # checker = ActiveSupport::EventedFileUpdateChecker.new(["/tmp/foo"]) { puts "changed" } + # checker.updated? + # # => false + # checker.execute_if_updated + # # => nil + # + # FileUtils.touch("/tmp/foo") + # + # checker.updated? + # # => true + # checker.execute_if_updated + # # => "changed" + # + class EventedFileUpdateChecker #:nodoc: all + def initialize(files, dirs = {}, &block) + unless block + raise ArgumentError, "A block is required to initialize an EventedFileUpdateChecker" + end + + @block = block + @core = Core.new(files, dirs) + ObjectSpace.define_finalizer(self, @core.finalizer) + end + + def updated? + if @core.restart? + @core.thread_safely(&:restart) + @core.updated.make_true + end + + @core.updated.true? + end + + def execute + @core.updated.make_false + @block.call + end + + def execute_if_updated + if updated? + yield if block_given? + execute + true + end + end + + class Core + attr_reader :updated + + def initialize(files, dirs) + @files = files.map { |file| Pathname(file).expand_path }.to_set + + @dirs = dirs.each_with_object({}) do |(dir, exts), hash| + hash[Pathname(dir).expand_path] = Array(exts).map { |ext| ext.to_s.sub(/\A\.?/, ".") }.to_set + end + + @common_path = common_path(@dirs.keys) + + @dtw = directories_to_watch + @missing = [] + + @updated = Concurrent::AtomicBoolean.new(false) + @mutex = Mutex.new + + start + @after_fork = ActiveSupport::ForkTracker.after_fork { start } + end + + def finalizer + proc do + stop + ActiveSupport::ForkTracker.unregister(@after_fork) + end + end + + def thread_safely + @mutex.synchronize do + yield self + end + end + + def start + normalize_dirs! + @dtw, @missing = [*@dtw, *@missing].partition(&:exist?) + @listener = @dtw.any? ? Listen.to(*@dtw, &method(:changed)) : nil + @listener&.start + end + + def stop + @listener&.stop + end + + def restart + stop + start + end + + def restart? + @missing.any?(&:exist?) + end + + def normalize_dirs! + @dirs.transform_keys! do |dir| + dir.exist? ? dir.realpath : dir + end + end + + def changed(modified, added, removed) + unless @updated.true? + @updated.make_true if (modified + added + removed).any? { |f| watching?(f) } + end + end + + def watching?(file) + file = Pathname(file) + + if @files.member?(file) + true + elsif file.directory? + false + else + ext = file.extname + + file.dirname.ascend do |dir| + matching = @dirs[dir] + + if matching && (matching.empty? || matching.include?(ext)) + break true + elsif dir == @common_path || dir.root? + break false + end + end + end + end + + def directories_to_watch + dtw = @dirs.keys | @files.map(&:dirname) + accounted_for = dtw.to_set + Gem.path.map { |path| Pathname(path) } + dtw.reject { |dir| dir.ascend.drop(1).any? { |parent| accounted_for.include?(parent) } } + end + + def common_path(paths) + paths.map { |path| path.ascend.to_a }.reduce(&:&)&.first + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/execution_wrapper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/execution_wrapper.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/execution_wrapper.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/execution_wrapper.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/executor.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/executor.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/executor.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/executor.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/file_update_checker.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/file_update_checker.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/file_update_checker.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/file_update_checker.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/fork_tracker.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/fork_tracker.rb new file mode 100644 index 0000000000..2020f79c2d --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/fork_tracker.rb @@ -0,0 +1,62 @@ +# frozen_string_literal: true + +module ActiveSupport + module ForkTracker # :nodoc: + module CoreExt + def fork(*) + if block_given? + super do + ForkTracker.check! + yield + end + else + unless pid = super + ForkTracker.check! + end + pid + end + end + end + + module CoreExtPrivate + include CoreExt + + private + def fork(*) + super + end + end + + @pid = Process.pid + @callbacks = [] + + class << self + def check! + if @pid != Process.pid + @callbacks.each(&:call) + @pid = Process.pid + end + end + + def hook! + if Process.respond_to?(:fork) + ::Object.prepend(CoreExtPrivate) + ::Kernel.prepend(CoreExtPrivate) + ::Kernel.singleton_class.prepend(CoreExt) + ::Process.singleton_class.prepend(CoreExt) + end + end + + def after_fork(&block) + @callbacks << block + block + end + + def unregister(callback) + @callbacks.delete(callback) + end + end + end +end + +ActiveSupport::ForkTracker.hook! diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/gem_version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/gem_version.rb similarity index 87% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/gem_version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/gem_version.rb index 62fec91674..4f034c3e03 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/gem_version.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/gem_version.rb @@ -8,9 +8,9 @@ module ActiveSupport module VERSION MAJOR = 6 - MINOR = 0 - TINY = 3 - PRE = "4" + MINOR = 1 + TINY = 0 + PRE = nil STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".") end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/gzip.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/gzip.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/gzip.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/gzip.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/hash_with_indifferent_access.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/hash_with_indifferent_access.rb similarity index 86% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/hash_with_indifferent_access.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/hash_with_indifferent_access.rb index 42ae7e9b7b..26a9db0654 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/hash_with_indifferent_access.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/hash_with_indifferent_access.rb @@ -69,7 +69,7 @@ module ActiveSupport super() update(constructor) - hash = constructor.to_hash + hash = constructor.is_a?(Hash) ? constructor : constructor.to_hash self.default = hash.default if hash.default self.default_proc = hash.default_proc if hash.default_proc else @@ -91,12 +91,12 @@ module ActiveSupport # # This value can be later fetched using either +:key+ or 'key'. def []=(key, value) - regular_writer(convert_key(key), convert_value(value, for: :assignment)) + regular_writer(convert_key(key), convert_value(value, conversion: :assignment)) end alias_method :store, :[]= - # Updates the receiver in-place, merging in the hash passed as argument: + # Updates the receiver in-place, merging in the hashes passed as arguments: # # hash_1 = ActiveSupport::HashWithIndifferentAccess.new # hash_1[:key] = 'value' @@ -106,7 +106,10 @@ module ActiveSupport # # hash_1.update(hash_2) # => {"key"=>"New Value!"} # - # The argument can be either an + # hash = ActiveSupport::HashWithIndifferentAccess.new + # hash.update({ "a" => 1 }, { "b" => 2 }) # => { "a" => 1, "b" => 2 } + # + # The arguments can be either an # ActiveSupport::HashWithIndifferentAccess or a regular +Hash+. # In either case the merge respects the semantics of indifferent access. # @@ -121,18 +124,15 @@ module ActiveSupport # hash_1[:key] = 10 # hash_2['key'] = 12 # hash_1.update(hash_2) { |key, old, new| old + new } # => {"key"=>22} - def update(other_hash) - if other_hash.is_a? HashWithIndifferentAccess - super(other_hash) + def update(*other_hashes, &block) + if other_hashes.size == 1 + update_with_single_argument(other_hashes.first, block) else - other_hash.to_hash.each_pair do |key, value| - if block_given? && key?(key) - value = yield(convert_key(key), self[key], value) - end - regular_writer(convert_key(key), convert_value(value)) + other_hashes.each do |other_hash| + update_with_single_argument(other_hash, block) end - self end + self end alias_method :merge!, :update @@ -259,8 +259,8 @@ module ActiveSupport # This method has the same semantics of +update+, except it does not # modify the receiver but rather returns a new hash with indifferent # access with the result of the merge. - def merge(hash, &block) - dup.update(hash, &block) + def merge(*hashes, &block) + dup.update(*hashes, &block) end # Like +merge+ but the other way around: Merges the receiver into the @@ -357,40 +357,59 @@ module ActiveSupport set_defaults(_new_hash) each do |key, value| - _new_hash[key] = convert_value(value, for: :to_hash) + _new_hash[key] = convert_value(value, conversion: :to_hash) end _new_hash end private - def convert_key(key) # :doc: - key.kind_of?(Symbol) ? key.to_s : key + if Symbol.method_defined?(:name) + def convert_key(key) + key.kind_of?(Symbol) ? key.name : key + end + else + def convert_key(key) + key.kind_of?(Symbol) ? key.to_s : key + end end - def convert_value(value, options = {}) # :doc: + def convert_value(value, conversion: nil) if value.is_a? Hash - if options[:for] == :to_hash + if conversion == :to_hash value.to_hash else value.nested_under_indifferent_access end elsif value.is_a?(Array) - if options[:for] != :assignment || value.frozen? + if conversion != :assignment || value.frozen? value = value.dup end - value.map! { |e| convert_value(e, options) } + value.map! { |e| convert_value(e, conversion: conversion) } else value end end - def set_defaults(target) # :doc: + def set_defaults(target) if default_proc target.default_proc = default_proc.dup else target.default = default end end + + def update_with_single_argument(other_hash, block) + if other_hash.is_a? HashWithIndifferentAccess + regular_update(other_hash, &block) + else + other_hash.to_hash.each_pair do |key, value| + if block && key?(key) + value = block.call(convert_key(key), self[key], value) + end + regular_writer(convert_key(key), convert_value(value)) + end + end + end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/i18n.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/i18n.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/i18n.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/i18n.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/i18n_railtie.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/i18n_railtie.rb similarity index 80% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/i18n_railtie.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/i18n_railtie.rb index 8b37f6a3ca..094f65ad6c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/i18n_railtie.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/i18n_railtie.rb @@ -12,9 +12,7 @@ module I18n config.i18n.load_path = [] config.i18n.fallbacks = ActiveSupport::OrderedOptions.new - if I18n.respond_to?(:eager_load!) - config.eager_load_namespaces << I18n - end + config.eager_load_namespaces << I18n # Set the i18n configuration after initialization since a lot of # configuration is still usually done in application initializers. @@ -50,8 +48,10 @@ module I18n app.config.i18n.load_path.unshift(*value.flat_map(&:existent)) when :load_path I18n.load_path += value + when :raise_on_missing_translations + forward_raise_on_missing_translations_config(app) else - I18n.send("#{setting}=", value) + I18n.public_send("#{setting}=", value) end end @@ -64,8 +64,6 @@ module I18n reloader = app.config.file_watcher.new(I18n.load_path.dup, directories) do I18n.load_path.keep_if { |p| File.exist?(p) } I18n.load_path |= reloadable_paths.flat_map(&:existent) - - I18n.reload! end app.reloaders << reloader @@ -77,6 +75,16 @@ module I18n @i18n_inited = true end + def self.forward_raise_on_missing_translations_config(app) + ActiveSupport.on_load(:action_view) do + self.raise_on_missing_translations = app.config.i18n.raise_on_missing_translations + end + + ActiveSupport.on_load(:action_controller) do + AbstractController::Translation.raise_on_missing_translations = app.config.i18n.raise_on_missing_translations + end + end + def self.include_fallbacks_module I18n.backend.class.include(I18n::Backend::Fallbacks) end @@ -94,19 +102,6 @@ module I18n [I18n.default_locale] end - if args.empty? || args.first.is_a?(Hash) - ActiveSupport::Deprecation.warn(<<-MSG.squish) - Using I18n fallbacks with an empty `defaults` sets the defaults to - include the `default_locale`. This behavior will change in Rails 6.1. - If you desire the default locale to be included in the defaults, please - explicitly configure it with `config.i18n.fallbacks.defaults = - [I18n.default_locale]` or `config.i18n.fallbacks = [I18n.default_locale, - {...}]`. If you want to opt-in to the new behavior, use - `config.i18n.fallbacks.defaults = [nil, {...}]`. - MSG - args.unshift I18n.default_locale - end - I18n.fallbacks = I18n::Locale::Fallbacks.new(*args) end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/inflections.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/inflections.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/inflections.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/inflections.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/inflector.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/inflector.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/inflector.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/inflector.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/inflector/inflections.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/inflector/inflections.rb similarity index 98% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/inflector/inflections.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/inflector/inflections.rb index 5b29a13894..99228a506f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/inflector/inflections.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/inflector/inflections.rb @@ -2,7 +2,6 @@ require "concurrent/map" require "active_support/i18n" -require "active_support/deprecation" module ActiveSupport module Inflector @@ -77,7 +76,7 @@ module ActiveSupport # Private, for the test suite. def initialize_dup(orig) # :nodoc: %w(plurals singulars uncountables humans acronyms).each do |scope| - instance_variable_set("@#{scope}", orig.send(scope).dup) + instance_variable_set("@#{scope}", orig.public_send(scope).dup) end define_acronym_regex_patterns end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/inflector/methods.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/inflector/methods.rb similarity index 90% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/inflector/methods.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/inflector/methods.rb index cb8ac62682..ad136532bf 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/inflector/methods.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/inflector/methods.rb @@ -1,6 +1,7 @@ # frozen_string_literal: true require "active_support/inflections" +require "active_support/core_ext/object/blank" module ActiveSupport # The Inflector transforms words from singular to plural, class names to table @@ -132,7 +133,7 @@ module ActiveSupport result.sub!(/\A_+/, "") unless keep_id_suffix - result.sub!(/_id\z/, "") + result.delete_suffix!("_id") end result.tr!("_", " ") @@ -172,7 +173,7 @@ module ActiveSupport # titleize('raiders_of_the_lost_ark') # => "Raiders Of The Lost Ark" # titleize('string_ending_with_id', keep_id_suffix: true) # => "String Ending With Id" def titleize(word, keep_id_suffix: false) - humanize(underscore(word), keep_id_suffix: keep_id_suffix).gsub(/\b(? 1 && names.first.empty? + # Remove the first blank element in case of '::ClassName' notation. + names.shift if names.size > 1 && names.first.empty? - names.inject(Object) do |constant, name| - if constant == Object - constant.const_get(name) - else - candidate = constant.const_get(name) - next candidate if constant.const_defined?(name, false) - next candidate unless Object.const_defined?(name) + names.inject(Object) do |constant, name| + if constant == Object + constant.const_get(name) + else + candidate = constant.const_get(name) + next candidate if constant.const_defined?(name, false) + next candidate unless Object.const_defined?(name) - # Go down the ancestors to check if it is owned directly. The check - # stops when we reach Object or the end of ancestors tree. - constant = constant.ancestors.inject(constant) do |const, ancestor| - break const if ancestor == Object - break ancestor if ancestor.const_defined?(name, false) - const + # Go down the ancestors to check if it is owned directly. The check + # stops when we reach Object or the end of ancestors tree. + constant = constant.ancestors.inject(constant) do |const, ancestor| + break const if ancestor == Object + break ancestor if ancestor.const_defined?(name, false) + const + end + + # owner is in Object, so raise + constant.const_get(name, false) end - - # owner is in Object, so raise - constant.const_get(name, false) end end end @@ -326,10 +331,9 @@ module ActiveSupport rescue NameError => e raise if e.name && !(camel_cased_word.to_s.split("::").include?(e.name.to_s) || e.name.to_s == camel_cased_word.to_s) - rescue ArgumentError => e - raise unless /not missing constant #{const_regexp(camel_cased_word)}!$/.match?(e.message) rescue LoadError => e - raise unless /Unable to autoload constant #{const_regexp(camel_cased_word)}/.match?(e.message) + message = e.respond_to?(:original_message) ? e.original_message : e.message + raise unless /Unable to autoload constant #{const_regexp(camel_cased_word)}/.match?(message) end # Returns the suffix that should be added to a number to denote the position @@ -371,7 +375,7 @@ module ActiveSupport last = parts.pop - parts.reverse.inject(last) do |acc, part| + parts.reverse!.inject(last) do |acc, part| part.empty? ? acc : "#{part}(::#{acc})?" end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/inflector/transliterate.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/inflector/transliterate.rb similarity index 94% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/inflector/transliterate.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/inflector/transliterate.rb index 3e8ffd46a0..c398b25d0f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/inflector/transliterate.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/inflector/transliterate.rb @@ -5,6 +5,8 @@ require "active_support/i18n" module ActiveSupport module Inflector + ALLOWED_ENCODINGS_FOR_TRANSLITERATE = [Encoding::UTF_8, Encoding::US_ASCII, Encoding::GB18030].freeze + # Replaces non-ASCII characters with an ASCII approximation, or if none # exists, a replacement character which defaults to "?". # @@ -62,9 +64,7 @@ module ActiveSupport def transliterate(string, replacement = "?", locale: nil) string = string.dup if string.frozen? raise ArgumentError, "Can only transliterate strings. Received #{string.class.name}" unless string.is_a?(String) - - allowed_encodings = [Encoding::UTF_8, Encoding::US_ASCII, Encoding::GB18030] - raise ArgumentError, "Can not transliterate strings with #{string.encoding} encoding" unless allowed_encodings.include?(string.encoding) + raise ArgumentError, "Cannot transliterate strings with #{string.encoding} encoding" unless ALLOWED_ENCODINGS_FOR_TRANSLITERATE.include?(string.encoding) input_encoding = string.encoding @@ -117,7 +117,7 @@ module ActiveSupport # If the optional parameter +locale+ is specified, # the word will be parameterized as a word of that language. # By default, this parameter is set to nil and it will use - # the configured I18n.locale. + # the configured I18n.locale. def parameterize(string, separator: "-", preserve_case: false, locale: nil) # Replace accented chars with their ASCII equivalents. parameterized_string = transliterate(string, locale: locale) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/key_generator.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/key_generator.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/key_generator.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/key_generator.rb index 8b61982883..21f7ab1bcb 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/key_generator.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/key_generator.rb @@ -35,7 +35,7 @@ module ActiveSupport # Returns a derived key suitable for use. def generate_key(*args) - @cache_keys[args.join] ||= @key_generator.generate_key(*args) + @cache_keys[args.join("|")] ||= @key_generator.generate_key(*args) end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/lazy_load_hooks.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/lazy_load_hooks.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/lazy_load_hooks.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/lazy_load_hooks.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/locale/en.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/locale/en.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/locale/en.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/locale/en.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/locale/en.yml b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/locale/en.yml similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/locale/en.yml rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/locale/en.yml index c64b7598ee..c4050517d5 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/locale/en.yml +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/locale/en.yml @@ -44,10 +44,12 @@ en: delimiter: "," # Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00) precision: 3 + # Determine how rounding is performed (see BigDecimal::mode) + round_mode: !ruby/sym default # If set to true, precision will mean the number of significant digits instead # of the number of decimal digits (1234 with precision 2 becomes 1200, 1.23543 becomes 1.2) significant: false - # If set, the zeros after the decimal separator will always be stripped (eg.: 1.200 will be 1.2) + # If set, the zeros after the decimal separator will always be stripped (e.g.: 1.200 will be 1.2) strip_insignificant_zeros: false # Used in NumberHelper.number_to_currency() @@ -56,10 +58,11 @@ en: # Where is the currency sign? %u is the currency unit, %n the number (default: $5.00) format: "%u%n" unit: "$" - # These five are to override number.format and are optional + # These six are to override number.format and are optional separator: "." delimiter: "," precision: 2 + # round_mode: significant: false strip_insignificant_zeros: false @@ -87,10 +90,11 @@ en: # Used in NumberHelper.number_to_human_size() and NumberHelper.number_to_human() human: format: - # These five are to override number.format and are optional + # These six are to override number.format and are optional # separator: delimiter: "" precision: 3 + # round_mode: significant: true strip_insignificant_zeros: true # Used in number_to_human_size() diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/logger.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/logger.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/logger.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/logger.rb index d8f537c64d..1e241c13ac 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/logger.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/logger.rb @@ -14,7 +14,7 @@ module ActiveSupport # ActiveSupport::Logger.logger_outputs_to?(logger, STDOUT) # # => true def self.logger_outputs_to?(logger, *sources) - logdev = logger.instance_variable_get("@logdev") + logdev = logger.instance_variable_get(:@logdev) logger_source = logdev.dev if logdev.respond_to?(:dev) sources.any? { |source| source == logger_source } end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/logger_silence.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/logger_silence.rb new file mode 100644 index 0000000000..8567eff403 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/logger_silence.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +require "active_support/concern" +require "active_support/core_ext/module/attribute_accessors" +require "active_support/logger_thread_safe_level" + +module ActiveSupport + module LoggerSilence + extend ActiveSupport::Concern + + included do + cattr_accessor :silencer, default: true + include ActiveSupport::LoggerThreadSafeLevel + end + + # Silences the logger for the duration of the block. + def silence(severity = Logger::ERROR) + silencer ? log_at(severity) { yield self } : yield(self) + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/logger_thread_safe_level.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/logger_thread_safe_level.rb new file mode 100644 index 0000000000..1de9ecdbbc --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/logger_thread_safe_level.rb @@ -0,0 +1,78 @@ +# frozen_string_literal: true + +require "active_support/concern" +require "active_support/core_ext/module/attribute_accessors" +require "concurrent" +require "fiber" + +module ActiveSupport + module LoggerThreadSafeLevel # :nodoc: + extend ActiveSupport::Concern + + included do + cattr_accessor :local_levels, default: Concurrent::Map.new(initial_capacity: 2), instance_accessor: false + end + + Logger::Severity.constants.each do |severity| + class_eval(<<-EOT, __FILE__, __LINE__ + 1) + def #{severity.downcase}? # def debug? + Logger::#{severity} >= level # DEBUG >= level + end # end + EOT + end + + def local_log_id + Fiber.current.__id__ + end + + def local_level + self.class.local_levels[local_log_id] + end + + def local_level=(level) + case level + when Integer + self.class.local_levels[local_log_id] = level + when Symbol + self.class.local_levels[local_log_id] = Logger::Severity.const_get(level.to_s.upcase) + when nil + self.class.local_levels.delete(local_log_id) + else + raise ArgumentError, "Invalid log level: #{level.inspect}" + end + end + + def level + local_level || super + end + + # Change the thread-local level for the duration of the given block. + def log_at(level) + old_local_level, self.local_level = local_level, level + yield + ensure + self.local_level = old_local_level + end + + # Redefined to check severity against #level, and thus the thread-local level, rather than +@level+. + # FIXME: Remove when the minimum Ruby version supports overriding Logger#level. + def add(severity, message = nil, progname = nil, &block) #:nodoc: + severity ||= UNKNOWN + progname ||= @progname + + return true if @logdev.nil? || severity < level + + if message.nil? + if block_given? + message = yield + else + message = progname + progname = @progname + end + end + + @logdev.write \ + format_message(format_severity(severity), Time.now, progname, message) + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/message_encryptor.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/message_encryptor.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/message_encryptor.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/message_encryptor.rb index 00548cb381..4cf4a44426 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/message_encryptor.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/message_encryptor.rb @@ -2,7 +2,6 @@ require "openssl" require "base64" -require "active_support/core_ext/array/extract_options" require "active_support/core_ext/module/attribute_accessors" require "active_support/message_verifier" require "active_support/messages/metadata" @@ -134,15 +133,13 @@ module ActiveSupport # * :digest - String of digest to use for signing. Default is # +SHA1+. Ignored when using an AEAD cipher like 'aes-256-gcm'. # * :serializer - Object serializer to use. Default is +Marshal+. - def initialize(secret, *signature_key_or_options) - options = signature_key_or_options.extract_options! - sign_secret = signature_key_or_options.first + def initialize(secret, sign_secret = nil, cipher: nil, digest: nil, serializer: nil) @secret = secret @sign_secret = sign_secret - @cipher = options[:cipher] || self.class.default_cipher - @digest = options[:digest] || "SHA1" unless aead_mode? + @cipher = cipher || self.class.default_cipher + @digest = digest || "SHA1" unless aead_mode? @verifier = resolve_verifier - @serializer = options[:serializer] || Marshal + @serializer = serializer || Marshal end # Encrypt and sign a message. We need to sign the message in order to avoid diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/message_verifier.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/message_verifier.rb similarity index 97% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/message_verifier.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/message_verifier.rb index 82865c779b..ba992a17a1 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/message_verifier.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/message_verifier.rb @@ -103,11 +103,11 @@ module ActiveSupport class InvalidSignature < StandardError; end - def initialize(secret, options = {}) + def initialize(secret, digest: nil, serializer: nil) raise ArgumentError, "Secret should not be nil." unless secret @secret = secret - @digest = options[:digest] || "SHA1" - @serializer = options[:serializer] || Marshal + @digest = digest || "SHA1" + @serializer = serializer || Marshal end # Checks if a signed message could have been generated by signing an object @@ -178,8 +178,8 @@ module ActiveSupport # Generates a signed message for the provided value. # - # The message is signed with the +MessageVerifier+'s secret. Without knowing - # the secret, the original value cannot be extracted from the message. + # The message is signed with the +MessageVerifier+'s secret. + # Returns Base64-encoded message joined with the generated signature. # # verifier = ActiveSupport::MessageVerifier.new 's3Krit' # verifier.generate 'a private message' # => "BAhJIhRwcml2YXRlLW1lc3NhZ2UGOgZFVA==--e2d724331ebdee96a10fb99b089508d1c72bd772" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/multibyte.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/multibyte.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/multibyte.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/multibyte.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/notifications.rb similarity index 85% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/notifications.rb index d9e93b530c..a7a6112b0f 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/notifications.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/notifications.rb @@ -38,6 +38,19 @@ module ActiveSupport # payload # => Hash, the payload # end # + # Here, the +start+ and +finish+ values represent wall-clock time. If you are + # concerned about accuracy, you can register a monotonic subscriber. + # + # ActiveSupport::Notifications.monotonic_subscribe('render') do |name, start, finish, id, payload| + # name # => String, name of the event (such as 'render' from above) + # start # => Monotonic time, when the instrumented block started execution + # finish # => Monotonic time, when the instrumented block ended execution + # id # => String, unique ID for the instrumenter that fired the event + # payload # => Hash, the payload + # end + # + # The +start+ and +finish+ values above represent monotonic time. + # # For instance, let's store all "render" events in an array: # # events = [] @@ -135,6 +148,16 @@ module ActiveSupport # during the execution of the block. The callback is unsubscribed automatically # after that. # + # To record +started+ and +finished+ values with monotonic time, + # specify the optional :monotonic option to the + # subscribed method. The :monotonic option is set + # to +false+ by default. + # + # callback = lambda {|name, started, finished, unique_id, payload| ... } + # ActiveSupport::Notifications.subscribed(callback, "sql.active_record", monotonic: true) do + # ... + # end + # # === Manual Unsubscription # # The +subscribe+ method returns a subscriber object: @@ -208,12 +231,16 @@ module ActiveSupport # ActiveSupport::Notifications.subscribe(/render/) do |event| # @event = event # end - def subscribe(*args, &block) - notifier.subscribe(*args, &block) + def subscribe(pattern = nil, callback = nil, &block) + notifier.subscribe(pattern, callback, monotonic: false, &block) end - def subscribed(callback, *args, &block) - subscriber = subscribe(*args, &callback) + def monotonic_subscribe(pattern = nil, callback = nil, &block) + notifier.subscribe(pattern, callback, monotonic: true, &block) + end + + def subscribed(callback, pattern = nil, monotonic: false, &block) + subscriber = notifier.subscribe(pattern, callback, monotonic: monotonic) yield ensure unsubscribe(subscriber) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/notifications/fanout.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/notifications/fanout.rb similarity index 87% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/notifications/fanout.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/notifications/fanout.rb index c506b35b1e..5fba8347d9 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/notifications/fanout.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/notifications/fanout.rb @@ -3,6 +3,7 @@ require "mutex_m" require "concurrent/map" require "set" +require "active_support/core_ext/object/try" module ActiveSupport module Notifications @@ -20,8 +21,8 @@ module ActiveSupport super end - def subscribe(pattern = nil, callable = nil, &block) - subscriber = Subscribers.new(pattern, callable || block) + def subscribe(pattern = nil, callable = nil, monotonic: false, &block) + subscriber = Subscribers.new(pattern, callable || block, monotonic) synchronize do if String === pattern @string_subscribers[pattern] << subscriber @@ -84,8 +85,8 @@ module ActiveSupport end module Subscribers # :nodoc: - def self.new(pattern, listener) - subscriber_class = Timed + def self.new(pattern, listener, monotonic) + subscriber_class = monotonic ? MonotonicTimed : Timed if listener.respond_to?(:start) && listener.respond_to?(:finish) subscriber_class = Evented @@ -103,10 +104,6 @@ module ActiveSupport wrap_all pattern, subscriber_class.new(pattern, listener) end - def self.event_object_subscriber(pattern, block) - wrap_all pattern, EventObject.new(pattern, block) - end - def self.wrap_all(pattern, subscriber) unless pattern AllMessages.new(subscriber) @@ -190,6 +187,23 @@ module ActiveSupport end end + class MonotonicTimed < Evented # :nodoc: + def publish(name, *args) + @delegate.call name, *args + end + + def start(name, id, payload) + timestack = Thread.current[:_timestack_monotonic] ||= [] + timestack.push Concurrent.monotonic_time + end + + def finish(name, id, payload) + timestack = Thread.current[:_timestack_monotonic] + started = timestack.pop + @delegate.call(name, started, Concurrent.monotonic_time, id, payload) + end + end + class EventObject < Evented def start(name, id, payload) stack = Thread.current[:_event_stack] ||= [] @@ -201,6 +215,7 @@ module ActiveSupport def finish(name, id, payload) stack = Thread.current[:_event_stack] event = stack.pop + event.payload = payload event.finish! @delegate.call event end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/notifications/instrumenter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/notifications/instrumenter.rb similarity index 88% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/notifications/instrumenter.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/notifications/instrumenter.rb index 927c382e5d..e1a9fe349c 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/notifications/instrumenter.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/notifications/instrumenter.rb @@ -52,14 +52,8 @@ module ActiveSupport end class Event - attr_reader :name, :time, :end, :transaction_id, :payload, :children - - def self.clock_gettime_supported? # :nodoc: - defined?(Process::CLOCK_THREAD_CPUTIME_ID) && - !Gem.win_platform? && - !RUBY_PLATFORM.match?(/solaris/i) - end - private_class_method :clock_gettime_supported? + attr_reader :name, :time, :end, :transaction_id, :children + attr_accessor :payload def initialize(name, start, ending, transaction_id, payload) @name = name @@ -88,11 +82,6 @@ module ActiveSupport @allocation_count_finish = now_allocations end - def end=(ending) - ActiveSupport::Deprecation.deprecation_warning(:end=, :finish!) - @end = ending - end - # Returns the CPU time (in milliseconds) passed since the call to # +start!+ and the call to +finish!+ def cpu_time @@ -140,11 +129,13 @@ module ActiveSupport Concurrent.monotonic_time end - if clock_gettime_supported? + begin + Process.clock_gettime(Process::CLOCK_THREAD_CPUTIME_ID) + def now_cpu Process.clock_gettime(Process::CLOCK_THREAD_CPUTIME_ID) end - else + rescue def now_cpu 0 end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/option_merger.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/option_merger.rb similarity index 85% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/option_merger.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/option_merger.rb index a4f40b02a4..c7f7c0aa6b 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/option_merger.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/option_merger.rb @@ -1,11 +1,12 @@ # frozen_string_literal: true require "active_support/core_ext/hash/deep_merge" +require "active_support/core_ext/symbol/starts_ends_with" module ActiveSupport class OptionMerger #:nodoc: instance_methods.each do |method| - undef_method(method) if !/^(__|instance_eval|class|object_id)/.match?(method) + undef_method(method) unless method.start_with?("__", "instance_eval", "class", "object_id") end def initialize(context, options) @@ -37,7 +38,7 @@ module ActiveSupport end else def invoke_method(method, arguments, options, &block) - arguments << options if options + arguments << options.dup if options @context.__send__(method, *arguments, &block) end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/ordered_hash.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/ordered_hash.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/ordered_hash.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/ordered_hash.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/ordered_options.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/ordered_options.rb similarity index 87% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/ordered_options.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/ordered_options.rb index 55c850dbce..ba14907d9e 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/ordered_options.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/ordered_options.rb @@ -3,7 +3,9 @@ require "active_support/core_ext/object/blank" module ActiveSupport - # Usually key value pairs are handled something like this: + # +OrderedOptions+ inherits from +Hash+ and provides dynamic accessor methods. + # + # With a +Hash+, key-value pairs are typically managed like this: # # h = {} # h[:boy] = 'John' @@ -12,7 +14,7 @@ module ActiveSupport # h[:girl] # => 'Mary' # h[:dog] # => nil # - # Using +OrderedOptions+, the above code could be reduced to: + # Using +OrderedOptions+, the above code can be written as: # # h = ActiveSupport::OrderedOptions.new # h.boy = 'John' @@ -60,6 +62,10 @@ module ActiveSupport def extractable_options? true end + + def inspect + "#<#{self.class.name} #{super}>" + end end # +InheritableOptions+ provides a constructor to build an +OrderedOptions+ diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/parameter_filter.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/parameter_filter.rb similarity index 87% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/parameter_filter.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/parameter_filter.rb index f700dbbea5..6f9289cab9 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/parameter_filter.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/parameter_filter.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true require "active_support/core_ext/object/duplicable" -require "active_support/core_ext/array/extract" module ActiveSupport # +ParameterFilter+ allows you to specify keys for sensitive data from @@ -22,7 +21,7 @@ module ActiveSupport # change { file: { code: "xxxx"} } # # ActiveSupport::ParameterFilter.new([-> (k, v) do - # v.reverse! if k =~ /secret/i + # v.reverse! if /secret/i.match?(k) # end]) # => reverses the value to all keys matching /secret/i class ParameterFilter @@ -59,24 +58,30 @@ module ActiveSupport def self.compile(filters, mask:) return lambda { |params| params.dup } if filters.empty? - strings, regexps, blocks = [], [], [] + strings, regexps, blocks, deep_regexps, deep_strings = [], [], [], nil, nil filters.each do |item| case item when Proc blocks << item when Regexp - regexps << item + if item.to_s.include?("\\.") + (deep_regexps ||= []) << item + else + regexps << item + end else - strings << Regexp.escape(item.to_s) + s = Regexp.escape(item.to_s) + if s.include?("\\.") + (deep_strings ||= []) << s + else + strings << s + end end end - deep_regexps = regexps.extract! { |r| r.to_s.include?("\\.") } - deep_strings = strings.extract! { |s| s.include?("\\.") } - regexps << Regexp.new(strings.join("|"), true) unless strings.empty? - deep_regexps << Regexp.new(deep_strings.join("|"), true) unless deep_strings.empty? + (deep_regexps ||= []) << Regexp.new(deep_strings.join("|"), true) if deep_strings&.any? new regexps, deep_regexps, blocks, mask: mask end @@ -85,7 +90,7 @@ module ActiveSupport def initialize(regexps, deep_regexps, blocks, mask:) @regexps = regexps - @deep_regexps = deep_regexps.any? ? deep_regexps : nil + @deep_regexps = deep_regexps&.any? ? deep_regexps : nil @blocks = blocks @mask = mask end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/per_thread_registry.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/per_thread_registry.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/per_thread_registry.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/per_thread_registry.rb index eb92fb4371..bf5a3b97ae 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/per_thread_registry.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/per_thread_registry.rb @@ -40,7 +40,7 @@ module ActiveSupport # If the class has an initializer, it must accept no arguments. module PerThreadRegistry def self.extended(object) - object.instance_variable_set "@per_thread_registry_key", object.name.freeze + object.instance_variable_set :@per_thread_registry_key, object.name.freeze end def instance diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/proxy_object.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/proxy_object.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/proxy_object.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/proxy_object.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/rails.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/rails.rb similarity index 88% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/rails.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/rails.rb index 8b727a69ec..75676a2e47 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/rails.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/rails.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -# This is private interface. +# This is a private interface. # # Rails components cherry pick from Active Support as needed, but there are a # few features that are used for sure in some way or another and it is not worth @@ -13,9 +13,6 @@ # Defines Object#blank? and Object#present?. require "active_support/core_ext/object/blank" -# Rails own autoload, eager_load, etc. -require "active_support/dependencies/autoload" - # Support for ClassMethods and the included macro. require "active_support/concern" diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/railtie.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/railtie.rb similarity index 74% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/railtie.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/railtie.rb index 605b50d346..c36453f7de 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/railtie.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/railtie.rb @@ -22,12 +22,25 @@ module ActiveSupport app.reloader.before_class_unload { ActiveSupport::CurrentAttributes.clear_all } app.executor.to_run { ActiveSupport::CurrentAttributes.reset_all } app.executor.to_complete { ActiveSupport::CurrentAttributes.reset_all } + + ActiveSupport.on_load(:active_support_test_case) do + require "active_support/current_attributes/test_helper" + include ActiveSupport::CurrentAttributes::TestHelper + end end initializer "active_support.deprecation_behavior" do |app| if deprecation = app.config.active_support.deprecation ActiveSupport::Deprecation.behavior = deprecation end + + if disallowed_deprecation = app.config.active_support.disallowed_deprecation + ActiveSupport::Deprecation.disallowed_behavior = disallowed_deprecation + end + + if disallowed_warnings = app.config.active_support.disallowed_deprecation_warnings + ActiveSupport::Deprecation.disallowed_warnings = disallowed_warnings + end end # Sets the default value for Time.zone @@ -65,15 +78,24 @@ module ActiveSupport initializer "active_support.set_configs" do |app| app.config.active_support.each do |k, v| k = "#{k}=" - ActiveSupport.send(k, v) if ActiveSupport.respond_to? k + ActiveSupport.public_send(k, v) if ActiveSupport.respond_to? k end end initializer "active_support.set_hash_digest_class" do |app| config.after_initialize do if app.config.active_support.use_sha1_digests + ActiveSupport::Deprecation.warn(<<-MSG.squish) + config.active_support.use_sha1_digests is deprecated and will + be removed from Rails 6.2. Use + config.active_support.hash_digest_class = ::Digest::SHA1 instead. + MSG ActiveSupport::Digest.hash_digest_class = ::Digest::SHA1 end + + if klass = app.config.active_support.hash_digest_class + ActiveSupport::Digest.hash_digest_class = klass + end end end end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/reloader.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/reloader.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/reloader.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/reloader.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/rescuable.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/rescuable.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/rescuable.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/rescuable.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/secure_compare_rotator.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/secure_compare_rotator.rb new file mode 100644 index 0000000000..269703c34a --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/secure_compare_rotator.rb @@ -0,0 +1,51 @@ +# frozen_string_literal: true + +require "active_support/security_utils" +require "active_support/messages/rotator" + +module ActiveSupport + # The ActiveSupport::SecureCompareRotator is a wrapper around +ActiveSupport::SecurityUtils.secure_compare+ + # and allows you to rotate a previously defined value to a new one. + # + # It can be used as follow: + # + # rotator = ActiveSupport::SecureCompareRotator.new('new_production_value') + # rotator.rotate('previous_production_value') + # rotator.secure_compare!('previous_production_value') + # + # One real use case example would be to rotate a basic auth credentials: + # + # class MyController < ApplicationController + # def authenticate_request + # rotator = ActiveSupport::SecureComparerotator.new('new_password') + # rotator.rotate('old_password') + # + # authenticate_or_request_with_http_basic do |username, password| + # rotator.secure_compare!(password) + # rescue ActiveSupport::SecureCompareRotator::InvalidMatch + # false + # end + # end + # end + class SecureCompareRotator + include SecurityUtils + prepend Messages::Rotator + + InvalidMatch = Class.new(StandardError) + + def initialize(value, **_options) + @value = value + end + + def secure_compare!(other_value, on_rotation: @on_rotation) + secure_compare(@value, other_value) || + run_rotations(on_rotation) { |wrapper| wrapper.secure_compare!(other_value) } || + raise(InvalidMatch) + end + + private + def build_rotation(previous_value, _options) + self.class.new(previous_value) + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/security_utils.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/security_utils.rb new file mode 100644 index 0000000000..4eeac896f7 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/security_utils.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +module ActiveSupport + module SecurityUtils + # Constant time string comparison, for fixed length strings. + # + # The values compared should be of fixed length, such as strings + # that have already been processed by HMAC. Raises in case of length mismatch. + + if defined?(OpenSSL.fixed_length_secure_compare) + def fixed_length_secure_compare(a, b) + OpenSSL.fixed_length_secure_compare(a, b) + end + else + def fixed_length_secure_compare(a, b) + raise ArgumentError, "string length mismatch." unless a.bytesize == b.bytesize + + l = a.unpack "C#{a.bytesize}" + + res = 0 + b.each_byte { |byte| res |= byte ^ l.shift } + res == 0 + end + end + module_function :fixed_length_secure_compare + + # Secure string comparison for strings of variable length. + # + # While a timing attack would not be able to discern the content of + # a secret compared via secure_compare, it is possible to determine + # the secret length. This should be considered when using secure_compare + # to compare weak, short secrets to user input. + def secure_compare(a, b) + a.length == b.length && fixed_length_secure_compare(a, b) + end + module_function :secure_compare + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/string_inquirer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/string_inquirer.rb similarity index 84% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/string_inquirer.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/string_inquirer.rb index e5091e127a..5ff3f4bfe7 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/string_inquirer.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/string_inquirer.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "active_support/core_ext/symbol/starts_ends_with" + module ActiveSupport # Wrapping a string in this class gives you a prettier way to test # for equality. The value returned by Rails.env is wrapped @@ -19,11 +21,11 @@ module ActiveSupport class StringInquirer < String private def respond_to_missing?(method_name, include_private = false) - (method_name[-1] == "?") || super + method_name.end_with?("?") || super end def method_missing(method_name, *arguments) - if method_name[-1] == "?" + if method_name.end_with?("?") self == method_name[0..-2] else super diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/subscriber.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/subscriber.rb similarity index 88% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/subscriber.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/subscriber.rb index c3cd175a52..24f8681af8 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/subscriber.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/subscriber.rb @@ -31,15 +31,16 @@ module ActiveSupport class Subscriber class << self # Attach the subscriber to a namespace. - def attach_to(namespace, subscriber = new, notifier = ActiveSupport::Notifications) + def attach_to(namespace, subscriber = new, notifier = ActiveSupport::Notifications, inherit_all: false) @namespace = namespace @subscriber = subscriber @notifier = notifier + @inherit_all = inherit_all subscribers << subscriber # Add event subscribers for all existing methods on the class. - subscriber.public_methods(false).each do |event| + fetch_public_methods(subscriber, inherit_all).each do |event| add_event_subscriber(event) end end @@ -55,7 +56,7 @@ module ActiveSupport subscribers.delete(subscriber) # Remove event subscribers of all existing methods on the class. - subscriber.public_methods(false).each do |event| + fetch_public_methods(subscriber, true).each do |event| remove_event_subscriber(event) end @@ -81,18 +82,18 @@ module ActiveSupport attr_reader :subscriber, :notifier, :namespace def add_event_subscriber(event) # :doc: - return if invalid_event?(event.to_s) + return if invalid_event?(event) pattern = prepare_pattern(event) - # Don't add multiple subscribers (eg. if methods are redefined). + # Don't add multiple subscribers (e.g. if methods are redefined). return if pattern_subscribed?(pattern) subscriber.patterns[pattern] = notifier.subscribe(pattern, subscriber) end def remove_event_subscriber(event) # :doc: - return if invalid_event?(event.to_s) + return if invalid_event?(event) pattern = prepare_pattern(event) @@ -107,7 +108,7 @@ module ActiveSupport end def invalid_event?(event) - %w{ start finish }.include?(event.to_s) + %i{ start finish }.include?(event.to_sym) end def prepare_pattern(event) @@ -117,6 +118,10 @@ module ActiveSupport def pattern_subscribed?(pattern) subscriber.patterns.key?(pattern) end + + def fetch_public_methods(subscriber, inherit_all) + subscriber.public_methods(inherit_all) - Subscriber.public_instance_methods(true) + end end attr_reader :patterns # :nodoc: diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/tagged_logging.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/tagged_logging.rb similarity index 71% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/tagged_logging.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/tagged_logging.rb index d8a86d997e..ed551011a4 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/tagged_logging.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/tagged_logging.rb @@ -8,11 +8,20 @@ require "active_support/logger" module ActiveSupport # Wraps any standard Logger object to provide tagging capabilities. # + # May be called with a block: + # # logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT)) # logger.tagged('BCX') { logger.info 'Stuff' } # Logs "[BCX] Stuff" # logger.tagged('BCX', "Jason") { logger.info 'Stuff' } # Logs "[BCX] [Jason] Stuff" # logger.tagged('BCX') { logger.tagged('Jason') { logger.info 'Stuff' } } # Logs "[BCX] [Jason] Stuff" # + # If called without a block, a new logger will be returned with applied tags: + # + # logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT)) + # logger.tagged("BCX").info "Stuff" # Logs "[BCX] Stuff" + # logger.tagged("BCX", "Jason").info "Stuff" # Logs "[BCX] [Jason] Stuff" + # logger.tagged("BCX").tagged("Jason").info "Stuff" # Logs "[BCX] [Jason] Stuff" + # # This is used by the default Rails.logger as configured by Railties to make # it easy to stamp log lines with subdomains, request ids, and anything else # to aid debugging of multi-user production applications. @@ -31,9 +40,10 @@ module ActiveSupport end def push_tags(*tags) - tags.flatten.reject(&:blank?).tap do |new_tags| - current_tags.concat new_tags - end + tags.flatten! + tags.reject!(&:blank?) + current_tags.concat tags + tags end def pop_tags(size = 1) @@ -60,6 +70,14 @@ module ActiveSupport end end + module LocalTagStorage # :nodoc: + attr_accessor :current_tags + + def self.extended(base) + base.current_tags = [] + end + end + def self.new(logger) logger = logger.dup @@ -77,7 +95,14 @@ module ActiveSupport delegate :push_tags, :pop_tags, :clear_tags!, to: :formatter def tagged(*tags) - formatter.tagged(*tags) { yield self } + if block_given? + formatter.tagged(*tags) { yield self } + else + logger = ActiveSupport::TaggedLogging.new(self) + logger.formatter.extend LocalTagStorage + logger.push_tags(*formatter.current_tags, *tags) + logger + end end def flush diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/test_case.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/test_case.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/test_case.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/test_case.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/time.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/time.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/time.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/time.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/time_with_zone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/time_with_zone.rb similarity index 86% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/time_with_zone.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/time_with_zone.rb index 3be5f6f7b5..e01457b56a 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/time_with_zone.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/time_with_zone.rb @@ -15,25 +15,25 @@ module ActiveSupport # and +in_time_zone+ on Time and DateTime instances. # # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' - # Time.zone.local(2007, 2, 10, 15, 30, 45) # => Sat, 10 Feb 2007 15:30:45 EST -05:00 - # Time.zone.parse('2007-02-10 15:30:45') # => Sat, 10 Feb 2007 15:30:45 EST -05:00 - # Time.zone.at(1171139445) # => Sat, 10 Feb 2007 15:30:45 EST -05:00 - # Time.zone.now # => Sun, 18 May 2008 13:07:55 EDT -04:00 - # Time.utc(2007, 2, 10, 20, 30, 45).in_time_zone # => Sat, 10 Feb 2007 15:30:45 EST -05:00 + # Time.zone.local(2007, 2, 10, 15, 30, 45) # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00 + # Time.zone.parse('2007-02-10 15:30:45') # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00 + # Time.zone.at(1171139445) # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00 + # Time.zone.now # => Sun, 18 May 2008 13:07:55.754107581 EDT -04:00 + # Time.utc(2007, 2, 10, 20, 30, 45).in_time_zone # => Sat, 10 Feb 2007 15:30:45.000000000 EST -05:00 # # See Time and TimeZone for further documentation of these methods. # # TimeWithZone instances implement the same API as Ruby Time instances, so # that Time and TimeWithZone instances are interchangeable. # - # t = Time.zone.now # => Sun, 18 May 2008 13:27:25 EDT -04:00 + # t = Time.zone.now # => Sun, 18 May 2008 13:27:25.031505668 EDT -04:00 # t.hour # => 13 # t.dst? # => true # t.utc_offset # => -14400 # t.zone # => "EDT" # t.to_s(:rfc822) # => "Sun, 18 May 2008 13:27:25 -0400" - # t + 1.day # => Mon, 19 May 2008 13:27:25 EDT -04:00 - # t.beginning_of_year # => Tue, 01 Jan 2008 00:00:00 EST -05:00 + # t + 1.day # => Mon, 19 May 2008 13:27:25.031505668 EDT -04:00 + # t.beginning_of_year # => Tue, 01 Jan 2008 00:00:00.000000000 EST -05:00 # t > Time.utc(1999) # => true # t.is_a?(Time) # => true # t.is_a?(ActiveSupport::TimeWithZone) # => true @@ -57,12 +57,12 @@ module ActiveSupport # Returns a Time instance that represents the time in +time_zone+. def time - @time ||= period.to_local(@utc) + @time ||= incorporate_utc_offset(@utc, utc_offset) end # Returns a Time instance of the simultaneous time in the UTC timezone. def utc - @utc ||= period.to_utc(@time) + @utc ||= incorporate_utc_offset(@time, -utc_offset) end alias_method :comparable_time, :utc alias_method :getgm, :utc @@ -104,13 +104,13 @@ module ActiveSupport # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' # Time.zone.now.utc? # => false def utc? - period.offset.abbreviation == :UTC || period.offset.abbreviation == :UCT + zone == "UTC" || zone == "UCT" end alias_method :gmt?, :utc? # Returns the offset from current time to UTC time in seconds. def utc_offset - period.utc_total_offset + period.observed_utc_offset end alias_method :gmt_offset, :utc_offset alias_method :gmtoff, :utc_offset @@ -132,14 +132,14 @@ module ActiveSupport # Time.zone = 'Eastern Time (US & Canada)' # => "Eastern Time (US & Canada)" # Time.zone.now.zone # => "EST" def zone - period.zone_identifier.to_s + period.abbreviation end # Returns a string of the object's date, time, zone, and offset from UTC. # - # Time.zone.now.inspect # => "Thu, 04 Dec 2014 11:00:25 EST -05:00" + # Time.zone.now.inspect # => "Thu, 04 Dec 2014 11:00:25.624541392 EST -05:00" def inspect - "#{time.strftime('%a, %d %b %Y %H:%M:%S')} #{zone} #{formatted_offset}" + "#{time.strftime('%a, %d %b %Y %H:%M:%S.%9N')} #{zone} #{formatted_offset}" end # Returns a string of the object's date and time in the ISO 8601 standard @@ -245,6 +245,20 @@ module ActiveSupport time.today? end + # Returns true if the current object's time falls within + # the next day (tomorrow). + def tomorrow? + time.tomorrow? + end + alias :next_day? :tomorrow? + + # Returns true if the current object's time falls within + # the previous day (yesterday). + def yesterday? + time.yesterday? + end + alias :prev_day? :yesterday? + # Returns true if the current object's time is in the future. def future? utc.future? @@ -263,8 +277,8 @@ module ActiveSupport # value as a new TimeWithZone object. # # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' - # now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28 EDT -04:00 - # now + 1000 # => Sun, 02 Nov 2014 01:43:08 EDT -04:00 + # now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00 + # now + 1000 # => Sun, 02 Nov 2014 01:43:08.725182881 EDT -04:00 # # If we're adding a Duration of variable length (i.e., years, months, days), # move forward from #time, otherwise move forward from #utc, for accuracy @@ -273,8 +287,8 @@ module ActiveSupport # For instance, a time + 24.hours will advance exactly 24 hours, while a # time + 1.day will advance 23-25 hours, depending on the day. # - # now + 24.hours # => Mon, 03 Nov 2014 00:26:28 EST -05:00 - # now + 1.day # => Mon, 03 Nov 2014 01:26:28 EST -05:00 + # now + 24.hours # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00 + # now + 1.day # => Mon, 03 Nov 2014 01:26:28.725182881 EST -05:00 def +(other) if duration_of_variable_length?(other) method_missing(:+, other) @@ -292,8 +306,8 @@ module ActiveSupport # object's time and the +other+ time. # # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' - # now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28 EST -05:00 - # now - 1000 # => Mon, 03 Nov 2014 00:09:48 EST -05:00 + # now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00 + # now - 1000 # => Mon, 03 Nov 2014 00:09:48.725182881 EST -05:00 # # If subtracting a Duration of variable length (i.e., years, months, days), # move backward from #time, otherwise move backward from #utc, for accuracy @@ -302,8 +316,8 @@ module ActiveSupport # For instance, a time - 24.hours will go subtract exactly 24 hours, while a # time - 1.day will subtract 23-25 hours, depending on the day. # - # now - 24.hours # => Sun, 02 Nov 2014 01:26:28 EDT -04:00 - # now - 1.day # => Sun, 02 Nov 2014 00:26:28 EDT -04:00 + # now - 24.hours # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00 + # now - 1.day # => Sun, 02 Nov 2014 00:26:28.725182881 EDT -04:00 # # If both the TimeWithZone object and the other value act like Time, a Float # will be returned. @@ -325,8 +339,8 @@ module ActiveSupport # the result as a new TimeWithZone object. # # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' - # now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28 EST -05:00 - # now.ago(1000) # => Mon, 03 Nov 2014 00:09:48 EST -05:00 + # now = Time.zone.now # => Mon, 03 Nov 2014 00:26:28.725182881 EST -05:00 + # now.ago(1000) # => Mon, 03 Nov 2014 00:09:48.725182881 EST -05:00 # # If we're subtracting a Duration of variable length (i.e., years, months, # days), move backward from #time, otherwise move backward from #utc, for @@ -336,8 +350,8 @@ module ActiveSupport # while time.ago(1.day) will move back 23-25 hours, depending on # the day. # - # now.ago(24.hours) # => Sun, 02 Nov 2014 01:26:28 EDT -04:00 - # now.ago(1.day) # => Sun, 02 Nov 2014 00:26:28 EDT -04:00 + # now.ago(24.hours) # => Sun, 02 Nov 2014 01:26:28.725182881 EDT -04:00 + # now.ago(1.day) # => Sun, 02 Nov 2014 00:26:28.725182881 EDT -04:00 def ago(other) since(-other) end @@ -353,12 +367,12 @@ module ActiveSupport # or :nsec, not both. Similarly, pass either :zone or # :offset, not both. # - # t = Time.zone.now # => Fri, 14 Apr 2017 11:45:15 EST -05:00 - # t.change(year: 2020) # => Tue, 14 Apr 2020 11:45:15 EST -05:00 - # t.change(hour: 12) # => Fri, 14 Apr 2017 12:00:00 EST -05:00 - # t.change(min: 30) # => Fri, 14 Apr 2017 11:30:00 EST -05:00 - # t.change(offset: "-10:00") # => Fri, 14 Apr 2017 11:45:15 HST -10:00 - # t.change(zone: "Hawaii") # => Fri, 14 Apr 2017 11:45:15 HST -10:00 + # t = Time.zone.now # => Fri, 14 Apr 2017 11:45:15.116992711 EST -05:00 + # t.change(year: 2020) # => Tue, 14 Apr 2020 11:45:15.116992711 EST -05:00 + # t.change(hour: 12) # => Fri, 14 Apr 2017 12:00:00.116992711 EST -05:00 + # t.change(min: 30) # => Fri, 14 Apr 2017 11:30:00.116992711 EST -05:00 + # t.change(offset: "-10:00") # => Fri, 14 Apr 2017 11:45:15.116992711 HST -10:00 + # t.change(zone: "Hawaii") # => Fri, 14 Apr 2017 11:45:15.116992711 HST -10:00 def change(options) if options[:zone] && options[:offset] raise ArgumentError, "Can't change both :offset and :zone at the same time: #{options.inspect}" @@ -391,14 +405,14 @@ module ActiveSupport # accuracy when moving across DST boundaries. # # Time.zone = 'Eastern Time (US & Canada)' # => 'Eastern Time (US & Canada)' - # now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28 EDT -04:00 - # now.advance(seconds: 1) # => Sun, 02 Nov 2014 01:26:29 EDT -04:00 - # now.advance(minutes: 1) # => Sun, 02 Nov 2014 01:27:28 EDT -04:00 - # now.advance(hours: 1) # => Sun, 02 Nov 2014 01:26:28 EST -05:00 - # now.advance(days: 1) # => Mon, 03 Nov 2014 01:26:28 EST -05:00 - # now.advance(weeks: 1) # => Sun, 09 Nov 2014 01:26:28 EST -05:00 - # now.advance(months: 1) # => Tue, 02 Dec 2014 01:26:28 EST -05:00 - # now.advance(years: 1) # => Mon, 02 Nov 2015 01:26:28 EST -05:00 + # now = Time.zone.now # => Sun, 02 Nov 2014 01:26:28.558049687 EDT -04:00 + # now.advance(seconds: 1) # => Sun, 02 Nov 2014 01:26:29.558049687 EDT -04:00 + # now.advance(minutes: 1) # => Sun, 02 Nov 2014 01:27:28.558049687 EDT -04:00 + # now.advance(hours: 1) # => Sun, 02 Nov 2014 01:26:28.558049687 EST -05:00 + # now.advance(days: 1) # => Mon, 03 Nov 2014 01:26:28.558049687 EST -05:00 + # now.advance(weeks: 1) # => Sun, 09 Nov 2014 01:26:28.558049687 EST -05:00 + # now.advance(months: 1) # => Tue, 02 Dec 2014 01:26:28.558049687 EST -05:00 + # now.advance(years: 1) # => Mon, 02 Nov 2015 01:26:28.558049687 EST -05:00 def advance(options) # If we're advancing a value of variable length (i.e., years, weeks, months, days), advance from #time, # otherwise advance from #utc, for accuracy when moving across DST boundaries @@ -420,7 +434,7 @@ module ActiveSupport # Returns Array of parts of Time in sequence of # [seconds, minutes, hours, day, month, year, weekday, yearday, dst?, zone]. # - # now = Time.zone.now # => Tue, 18 Aug 2015 02:29:27 UTC +00:00 + # now = Time.zone.now # => Tue, 18 Aug 2015 02:29:27.485278555 UTC +00:00 # now.to_a # => [27, 29, 2, 18, 8, 2015, 2, 230, false, "UTC"] def to_a [time.sec, time.min, time.hour, time.day, time.mon, time.year, time.wday, time.yday, dst?, zone] @@ -524,6 +538,16 @@ module ActiveSupport end private + SECONDS_PER_DAY = 86400 + + def incorporate_utc_offset(time, offset) + if time.kind_of?(Date) + time + Rational(offset, SECONDS_PER_DAY) + else + time + offset + end + end + def get_period_and_ensure_valid_local_time(period) # we don't want a Time.local instance enforcing its own DST rules as well, # so transfer time values to a utc constructor if necessary diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/values/time_zone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/values/time_zone.rb similarity index 95% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/values/time_zone.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/values/time_zone.rb index d9e033e23b..2e5d9d3e9d 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/values/time_zone.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/values/time_zone.rb @@ -203,7 +203,7 @@ module ActiveSupport end def find_tzinfo(name) - TZInfo::Timezone.new(MAPPING[name] || name) + TZInfo::Timezone.get(MAPPING[name] || name) end alias_method :create, :new @@ -273,7 +273,7 @@ module ActiveSupport memo end else - create(tz_id, nil, TZInfo::Timezone.new(tz_id)) + create(tz_id, nil, TZInfo::Timezone.get(tz_id)) end end.sort! end @@ -302,11 +302,7 @@ module ActiveSupport # Returns the offset of this time zone from UTC in seconds. def utc_offset - if @utc_offset - @utc_offset - else - tzinfo.current_period.utc_offset if tzinfo && tzinfo.current_period - end + @utc_offset || tzinfo&.current_period&.base_utc_offset end # Returns a formatted string of the offset from UTC, or an alternative @@ -334,6 +330,13 @@ module ActiveSupport re === name || re === MAPPING[name] end + # Compare #name and TZInfo identifier to a supplied regexp, returning +true+ + # if a match is found. + def match?(re) + (re == name) || (re == MAPPING[name]) || + ((Regexp === re) && (re.match?(name) || re.match?(MAPPING[name]))) + end + # Returns a textual representation of this time zone. def to_s "(GMT#{formatted_offset}) #{name}" @@ -500,10 +503,17 @@ module ActiveSupport end # Adjust the given time to the simultaneous time in the time zone - # represented by +self+. Returns a Time.utc() instance -- if you want an - # ActiveSupport::TimeWithZone instance, use Time#in_time_zone() instead. + # represented by +self+. Returns a local time with the appropriate offset + # -- if you want an ActiveSupport::TimeWithZone instance, use + # Time#in_time_zone() instead. + # + # As of tzinfo 2, utc_to_local returns a Time with a non-zero utc_offset. + # See the `utc_to_local_returns_utc_offset_times` config for more info. def utc_to_local(time) - tzinfo.utc_to_local(time) + tzinfo.utc_to_local(time).yield_self do |t| + ActiveSupport.utc_to_local_returns_utc_offset_times ? + t : Time.utc(t.year, t.month, t.day, t.hour, t.min, t.sec, t.sec_fraction) + end end # Adjust the given time to the simultaneous time in UTC. Returns a diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/version.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/version.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/version.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/xml_mini.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/xml_mini.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/xml_mini.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/xml_mini.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/xml_mini/jdom.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/xml_mini/jdom.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/xml_mini/jdom.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/xml_mini/jdom.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/xml_mini/libxml.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/xml_mini/libxml.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/xml_mini/libxml.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/xml_mini/libxml.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/xml_mini/libxmlsax.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/xml_mini/libxmlsax.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/xml_mini/libxmlsax.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/xml_mini/libxmlsax.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/xml_mini/nokogiri.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/xml_mini/nokogiri.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/xml_mini/nokogiri.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/xml_mini/nokogiri.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/xml_mini/nokogirisax.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/xml_mini/nokogirisax.rb similarity index 100% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/xml_mini/nokogirisax.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/xml_mini/nokogirisax.rb diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/xml_mini/rexml.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/xml_mini/rexml.rb similarity index 92% rename from Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/xml_mini/rexml.rb rename to Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/xml_mini/rexml.rb index 8d6e3af066..c700959f71 100644 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.3.4/lib/active_support/xml_mini/rexml.rb +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/activesupport-6.1.0/lib/active_support/xml_mini/rexml.rb @@ -25,7 +25,7 @@ module ActiveSupport if data.eof? {} else - silence_warnings { require "rexml/document" } unless defined?(REXML::Document) + require_rexml unless defined?(REXML::Document) doc = REXML::Document.new(data) if doc.root @@ -38,6 +38,13 @@ module ActiveSupport end private + def require_rexml + silence_warnings { require "rexml/document" } + rescue LoadError => e + $stderr.puts "You don't have rexml installed in your application. Please add it to your Gemfile and run bundle install" + raise e + end + # Convert an XML element and merge into the hash # # hash:: diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe.rb deleted file mode 100644 index 5b8fb273cd..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe.rb +++ /dev/null @@ -1,65 +0,0 @@ -require 'thread_safe/version' -require 'thread_safe/synchronized_delegator' - -module ThreadSafe - autoload :Cache, 'thread_safe/cache' - autoload :Util, 'thread_safe/util' - - # Various classes within allows for +nil+ values to be stored, so a special +NULL+ token is required to indicate the "nil-ness". - NULL = Object.new - - if defined?(JRUBY_VERSION) - require 'jruby/synchronized' - - # A thread-safe subclass of Array. This version locks - # against the object itself for every method call, - # ensuring only one thread can be reading or writing - # at a time. This includes iteration methods like - # #each. - class Array < ::Array - include JRuby::Synchronized - end - - # A thread-safe subclass of Hash. This version locks - # against the object itself for every method call, - # ensuring only one thread can be reading or writing - # at a time. This includes iteration methods like - # #each. - class Hash < ::Hash - include JRuby::Synchronized - end - elsif !defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby' - # Because MRI never runs code in parallel, the existing - # non-thread-safe structures should usually work fine. - Array = ::Array - Hash = ::Hash - elsif defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx' - require 'monitor' - - class Hash < ::Hash; end - class Array < ::Array; end - - [Hash, Array].each do |klass| - klass.class_eval do - private - def _mon_initialize - @_monitor = Monitor.new unless @_monitor # avoid double initialisation - end - - def self.allocate - obj = super - obj.send(:_mon_initialize) - obj - end - end - - klass.superclass.instance_methods(false).each do |method| - klass.class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1 - def #{method}(*args) - @_monitor.synchronize { super } - end - RUBY_EVAL - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/atomic_reference_cache_backend.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/atomic_reference_cache_backend.rb deleted file mode 100644 index 7e710b5c3e..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/atomic_reference_cache_backend.rb +++ /dev/null @@ -1,908 +0,0 @@ -module ThreadSafe - # A Ruby port of the Doug Lea's jsr166e.ConcurrentHashMapV8 class version 1.59 - # available in public domain. - # - # Original source code available here: - # http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/jsr166e/ConcurrentHashMapV8.java?revision=1.59 - # - # The Ruby port skips out the +TreeBin+ (red-black trees for use in bins whose - # size exceeds a threshold). - # - # A hash table supporting full concurrency of retrievals and high expected - # concurrency for updates. However, even though all operations are - # thread-safe, retrieval operations do _not_ entail locking, and there is - # _not_ any support for locking the entire table in a way that prevents all - # access. - # - # Retrieval operations generally do not block, so may overlap with update - # operations. Retrievals reflect the results of the most recently _completed_ - # update operations holding upon their onset. (More formally, an update - # operation for a given key bears a _happens-before_ relation with any (non - # +nil+) retrieval for that key reporting the updated value.) For aggregate - # operations such as +clear()+, concurrent retrievals may reflect insertion or - # removal of only some entries. Similarly, the +each_pair+ iterator yields - # elements reflecting the state of the hash table at some point at or since - # the start of the +each_pair+. Bear in mind that the results of aggregate - # status methods including +size()+ and +empty?+} are typically useful only - # when a map is not undergoing concurrent updates in other threads. Otherwise - # the results of these methods reflect transient states that may be adequate - # for monitoring or estimation purposes, but not for program control. - # - # The table is dynamically expanded when there are too many collisions (i.e., - # keys that have distinct hash codes but fall into the same slot modulo the - # table size), with the expected average effect of maintaining roughly two - # bins per mapping (corresponding to a 0.75 load factor threshold for - # resizing). There may be much variance around this average as mappings are - # added and removed, but overall, this maintains a commonly accepted - # time/space tradeoff for hash tables. However, resizing this or any other - # kind of hash table may be a relatively slow operation. When possible, it is - # a good idea to provide a size estimate as an optional :initial_capacity - # initializer argument. An additional optional :load_factor constructor - # argument provides a further means of customizing initial table capacity by - # specifying the table density to be used in calculating the amount of space - # to allocate for the given number of elements. Note that using many keys with - # exactly the same +hash+ is a sure way to slow down performance of any hash - # table. - # - # ## Design overview - # - # The primary design goal of this hash table is to maintain concurrent - # readability (typically method +[]+, but also iteration and related methods) - # while minimizing update contention. Secondary goals are to keep space - # consumption about the same or better than plain +Hash+, and to support high - # initial insertion rates on an empty table by many threads. - # - # Each key-value mapping is held in a +Node+. The validation-based approach - # explained below leads to a lot of code sprawl because retry-control - # precludes factoring into smaller methods. - # - # The table is lazily initialized to a power-of-two size upon the first - # insertion. Each bin in the table normally contains a list of +Node+s (most - # often, the list has only zero or one +Node+). Table accesses require - # volatile/atomic reads, writes, and CASes. The lists of nodes within bins are - # always accurately traversable under volatile reads, so long as lookups check - # hash code and non-nullness of value before checking key equality. - # - # We use the top two bits of +Node+ hash fields for control purposes -- they - # are available anyway because of addressing constraints. As explained further - # below, these top bits are used as follows: - # - # - 00 - Normal - # - 01 - Locked - # - 11 - Locked and may have a thread waiting for lock - # - 10 - +Node+ is a forwarding node - # - # The lower 28 bits of each +Node+'s hash field contain a the key's hash code, - # except for forwarding nodes, for which the lower bits are zero (and so - # always have hash field == +MOVED+). - # - # Insertion (via +[]=+ or its variants) of the first node in an empty bin is - # performed by just CASing it to the bin. This is by far the most common case - # for put operations under most key/hash distributions. Other update - # operations (insert, delete, and replace) require locks. We do not want to - # waste the space required to associate a distinct lock object with each bin, - # so instead use the first node of a bin list itself as a lock. Blocking - # support for these locks relies +Util::CheapLockable. However, we also need a - # +try_lock+ construction, so we overlay these by using bits of the +Node+ - # hash field for lock control (see above), and so normally use builtin - # monitors only for blocking and signalling using - # +cheap_wait+/+cheap_broadcast+ constructions. See +Node#try_await_lock+. - # - # Using the first node of a list as a lock does not by itself suffice though: - # When a node is locked, any update must first validate that it is still the - # first node after locking it, and retry if not. Because new nodes are always - # appended to lists, once a node is first in a bin, it remains first until - # deleted or the bin becomes invalidated (upon resizing). However, operations - # that only conditionally update may inspect nodes until the point of update. - # This is a converse of sorts to the lazy locking technique described by - # Herlihy & Shavit. - # - # The main disadvantage of per-bin locks is that other update operations on - # other nodes in a bin list protected by the same lock can stall, for example - # when user +eql?+ or mapping functions take a long time. However, - # statistically, under random hash codes, this is not a common problem. - # Ideally, the frequency of nodes in bins follows a Poisson distribution - # (http://en.wikipedia.org/wiki/Poisson_distribution) with a parameter of - # about 0.5 on average, given the resizing threshold of 0.75, although with a - # large variance because of resizing granularity. Ignoring variance, the - # expected occurrences of list size k are (exp(-0.5) * pow(0.5, k) / - # factorial(k)). The first values are: - # - # - 0: 0.60653066 - # - 1: 0.30326533 - # - 2: 0.07581633 - # - 3: 0.01263606 - # - 4: 0.00157952 - # - 5: 0.00015795 - # - 6: 0.00001316 - # - 7: 0.00000094 - # - 8: 0.00000006 - # - more: less than 1 in ten million - # - # Lock contention probability for two threads accessing distinct elements is - # roughly 1 / (8 * #elements) under random hashes. - # - # The table is resized when occupancy exceeds a percentage threshold - # (nominally, 0.75, but see below). Only a single thread performs the resize - # (using field +size_control+, to arrange exclusion), but the table otherwise - # remains usable for reads and updates. Resizing proceeds by transferring - # bins, one by one, from the table to the next table. Because we are using - # power-of-two expansion, the elements from each bin must either stay at same - # index, or move with a power of two offset. We eliminate unnecessary node - # creation by catching cases where old nodes can be reused because their next - # fields won't change. On average, only about one-sixth of them need cloning - # when a table doubles. The nodes they replace will be garbage collectable as - # soon as they are no longer referenced by any reader thread that may be in - # the midst of concurrently traversing table. Upon transfer, the old table bin - # contains only a special forwarding node (with hash field +MOVED+) that - # contains the next table as its key. On encountering a forwarding node, - # access and update operations restart, using the new table. - # - # Each bin transfer requires its bin lock. However, unlike other cases, a - # transfer can skip a bin if it fails to acquire its lock, and revisit it - # later. Method +rebuild+ maintains a buffer of TRANSFER_BUFFER_SIZE bins that - # have been skipped because of failure to acquire a lock, and blocks only if - # none are available (i.e., only very rarely). The transfer operation must - # also ensure that all accessible bins in both the old and new table are - # usable by any traversal. When there are no lock acquisition failures, this - # is arranged simply by proceeding from the last bin (+table.size - 1+) up - # towards the first. Upon seeing a forwarding node, traversals arrange to move - # to the new table without revisiting nodes. However, when any node is skipped - # during a transfer, all earlier table bins may have become visible, so are - # initialized with a reverse-forwarding node back to the old table until the - # new ones are established. (This sometimes requires transiently locking a - # forwarding node, which is possible under the above encoding.) These more - # expensive mechanics trigger only when necessary. - # - # The traversal scheme also applies to partial traversals of - # ranges of bins (via an alternate Traverser constructor) - # to support partitioned aggregate operations. Also, read-only - # operations give up if ever forwarded to a null table, which - # provides support for shutdown-style clearing, which is also not - # currently implemented. - # - # Lazy table initialization minimizes footprint until first use. - # - # The element count is maintained using a +ThreadSafe::Util::Adder+, - # which avoids contention on updates but can encounter cache thrashing - # if read too frequently during concurrent access. To avoid reading so - # often, resizing is attempted either when a bin lock is - # contended, or upon adding to a bin already holding two or more - # nodes (checked before adding in the +x_if_absent+ methods, after - # adding in others). Under uniform hash distributions, the - # probability of this occurring at threshold is around 13%, - # meaning that only about 1 in 8 puts check threshold (and after - # resizing, many fewer do so). But this approximation has high - # variance for small table sizes, so we check on any collision - # for sizes <= 64. The bulk putAll operation further reduces - # contention by only committing count updates upon these size - # checks. - class AtomicReferenceCacheBackend - class Table < Util::PowerOfTwoTuple - def cas_new_node(i, hash, key, value) - cas(i, nil, Node.new(hash, key, value)) - end - - def try_to_cas_in_computed(i, hash, key) - succeeded = false - new_value = nil - new_node = Node.new(locked_hash = hash | LOCKED, key, NULL) - if cas(i, nil, new_node) - begin - if NULL == (new_value = yield(NULL)) - was_null = true - else - new_node.value = new_value - end - succeeded = true - ensure - volatile_set(i, nil) if !succeeded || was_null - new_node.unlock_via_hash(locked_hash, hash) - end - end - return succeeded, new_value - end - - def try_lock_via_hash(i, node, node_hash) - node.try_lock_via_hash(node_hash) do - yield if volatile_get(i) == node - end - end - - def delete_node_at(i, node, predecessor_node) - if predecessor_node - predecessor_node.next = node.next - else - volatile_set(i, node.next) - end - end - end - - # Key-value entry. Nodes with a hash field of +MOVED+ are special, and do - # not contain user keys or values. Otherwise, keys are never +nil+, and - # +NULL+ +value+ fields indicate that a node is in the process of being - # deleted or created. For purposes of read-only access, a key may be read - # before a value, but can only be used after checking value to be +!= NULL+. - class Node - extend Util::Volatile - attr_volatile :hash, :value, :next - - include Util::CheapLockable - - bit_shift = Util::FIXNUM_BIT_SIZE - 2 # need 2 bits for ourselves - # Encodings for special uses of Node hash fields. See above for explanation. - MOVED = ('10' << ('0' * bit_shift)).to_i(2) # hash field for forwarding nodes - LOCKED = ('01' << ('0' * bit_shift)).to_i(2) # set/tested only as a bit - WAITING = ('11' << ('0' * bit_shift)).to_i(2) # both bits set/tested together - HASH_BITS = ('00' << ('1' * bit_shift)).to_i(2) # usable bits of normal node hash - - SPIN_LOCK_ATTEMPTS = Util::CPU_COUNT > 1 ? Util::CPU_COUNT * 2 : 0 - - attr_reader :key - - def initialize(hash, key, value, next_node = nil) - super() - @key = key - self.lazy_set_hash(hash) - self.lazy_set_value(value) - self.next = next_node - end - - # Spins a while if +LOCKED+ bit set and this node is the first of its bin, - # and then sets +WAITING+ bits on hash field and blocks (once) if they are - # still set. It is OK for this method to return even if lock is not - # available upon exit, which enables these simple single-wait mechanics. - # - # The corresponding signalling operation is performed within callers: Upon - # detecting that +WAITING+ has been set when unlocking lock (via a failed - # CAS from non-waiting +LOCKED+ state), unlockers acquire the - # +cheap_synchronize+ lock and perform a +cheap_broadcast+. - def try_await_lock(table, i) - if table && i >= 0 && i < table.size # bounds check, TODO: why are we bounds checking? - spins = SPIN_LOCK_ATTEMPTS - randomizer = base_randomizer = Util::XorShiftRandom.get - while equal?(table.volatile_get(i)) && self.class.locked_hash?(my_hash = hash) - if spins >= 0 - if (randomizer = (randomizer >> 1)).even? # spin at random - if (spins -= 1) == 0 - Thread.pass # yield before blocking - else - randomizer = base_randomizer = Util::XorShiftRandom.xorshift(base_randomizer) if randomizer.zero? - end - end - elsif cas_hash(my_hash, my_hash | WAITING) - force_aquire_lock(table, i) - break - end - end - end - end - - def key?(key) - @key.eql?(key) - end - - def matches?(key, hash) - pure_hash == hash && key?(key) - end - - def pure_hash - hash & HASH_BITS - end - - def try_lock_via_hash(node_hash = hash) - if cas_hash(node_hash, locked_hash = node_hash | LOCKED) - begin - yield - ensure - unlock_via_hash(locked_hash, node_hash) - end - end - end - - def locked? - self.class.locked_hash?(hash) - end - - def unlock_via_hash(locked_hash, node_hash) - unless cas_hash(locked_hash, node_hash) - self.hash = node_hash - cheap_synchronize { cheap_broadcast } - end - end - - private - def force_aquire_lock(table, i) - cheap_synchronize do - if equal?(table.volatile_get(i)) && (hash & WAITING) == WAITING - cheap_wait - else - cheap_broadcast # possibly won race vs signaller - end - end - end - - class << self - def locked_hash?(hash) - (hash & LOCKED) != 0 - end - end - end - - # shorthands - MOVED = Node::MOVED - LOCKED = Node::LOCKED - WAITING = Node::WAITING - HASH_BITS = Node::HASH_BITS - - NOW_RESIZING = -1 - DEFAULT_CAPACITY = 16 - MAX_CAPACITY = Util::MAX_INT - - # The buffer size for skipped bins during transfers. The - # value is arbitrary but should be large enough to avoid - # most locking stalls during resizes. - TRANSFER_BUFFER_SIZE = 32 - - extend Util::Volatile - attr_volatile :table, # The array of bins. Lazily initialized upon first insertion. Size is always a power of two. - - # Table initialization and resizing control. When negative, the - # table is being initialized or resized. Otherwise, when table is - # null, holds the initial table size to use upon creation, or 0 - # for default. After initialization, holds the next element count - # value upon which to resize the table. - :size_control - - def initialize(options = nil) - super() - @counter = Util::Adder.new - initial_capacity = options && options[:initial_capacity] || DEFAULT_CAPACITY - self.size_control = (capacity = table_size_for(initial_capacity)) > MAX_CAPACITY ? MAX_CAPACITY : capacity - end - - def get_or_default(key, else_value = nil) - hash = key_hash(key) - current_table = table - while current_table - node = current_table.volatile_get_by_hash(hash) - current_table = - while node - if (node_hash = node.hash) == MOVED - break node.key - elsif (node_hash & HASH_BITS) == hash && node.key?(key) && NULL != (value = node.value) - return value - end - node = node.next - end - end - else_value - end - - def [](key) - get_or_default(key) - end - - def key?(key) - get_or_default(key, NULL) != NULL - end - - def []=(key, value) - get_and_set(key, value) - value - end - - def compute_if_absent(key) - hash = key_hash(key) - current_table = table || initialize_table - while true - if !(node = current_table.volatile_get(i = current_table.hash_to_index(hash))) - succeeded, new_value = current_table.try_to_cas_in_computed(i, hash, key) { yield } - if succeeded - increment_size - return new_value - end - elsif (node_hash = node.hash) == MOVED - current_table = node.key - elsif NULL != (current_value = find_value_in_node_list(node, key, hash, node_hash & HASH_BITS)) - return current_value - elsif Node.locked_hash?(node_hash) - try_await_lock(current_table, i, node) - else - succeeded, value = attempt_internal_compute_if_absent(key, hash, current_table, i, node, node_hash) { yield } - return value if succeeded - end - end - end - - def compute_if_present(key) - new_value = nil - internal_replace(key) do |old_value| - if (new_value = yield(NULL == old_value ? nil : old_value)).nil? - NULL - else - new_value - end - end - new_value - end - - def compute(key) - internal_compute(key) do |old_value| - if (new_value = yield(NULL == old_value ? nil : old_value)).nil? - NULL - else - new_value - end - end - end - - def merge_pair(key, value) - internal_compute(key) do |old_value| - if NULL == old_value || !(value = yield(old_value)).nil? - value - else - NULL - end - end - end - - def replace_pair(key, old_value, new_value) - NULL != internal_replace(key, old_value) { new_value } - end - - def replace_if_exists(key, new_value) - if (result = internal_replace(key) { new_value }) && NULL != result - result - end - end - - def get_and_set(key, value) # internalPut in the original CHMV8 - hash = key_hash(key) - current_table = table || initialize_table - while true - if !(node = current_table.volatile_get(i = current_table.hash_to_index(hash))) - if current_table.cas_new_node(i, hash, key, value) - increment_size - break - end - elsif (node_hash = node.hash) == MOVED - current_table = node.key - elsif Node.locked_hash?(node_hash) - try_await_lock(current_table, i, node) - else - succeeded, old_value = attempt_get_and_set(key, value, hash, current_table, i, node, node_hash) - break old_value if succeeded - end - end - end - - def delete(key) - replace_if_exists(key, NULL) - end - - def delete_pair(key, value) - result = internal_replace(key, value) { NULL } - if result && NULL != result - !!result - else - false - end - end - - def each_pair - return self unless current_table = table - current_table_size = base_size = current_table.size - i = base_index = 0 - while base_index < base_size - if node = current_table.volatile_get(i) - if node.hash == MOVED - current_table = node.key - current_table_size = current_table.size - else - begin - if NULL != (value = node.value) # skip deleted or special nodes - yield node.key, value - end - end while node = node.next - end - end - - if (i_with_base = i + base_size) < current_table_size - i = i_with_base # visit upper slots if present - else - i = base_index += 1 - end - end - self - end - - def size - (sum = @counter.sum) < 0 ? 0 : sum # ignore transient negative values - end - - def empty? - size == 0 - end - - # Implementation for clear. Steps through each bin, removing all nodes. - def clear - return self unless current_table = table - current_table_size = current_table.size - deleted_count = i = 0 - while i < current_table_size - if !(node = current_table.volatile_get(i)) - i += 1 - elsif (node_hash = node.hash) == MOVED - current_table = node.key - current_table_size = current_table.size - elsif Node.locked_hash?(node_hash) - decrement_size(deleted_count) # opportunistically update count - deleted_count = 0 - node.try_await_lock(current_table, i) - else - current_table.try_lock_via_hash(i, node, node_hash) do - begin - deleted_count += 1 if NULL != node.value # recheck under lock - node.value = nil - end while node = node.next - current_table.volatile_set(i, nil) - i += 1 - end - end - end - decrement_size(deleted_count) - self - end - - private - # Internal versions of the insertion methods, each a - # little more complicated than the last. All have - # the same basic structure: - # 1. If table uninitialized, create - # 2. If bin empty, try to CAS new node - # 3. If bin stale, use new table - # 4. Lock and validate; if valid, scan and add or update - # - # The others interweave other checks and/or alternative actions: - # * Plain +get_and_set+ checks for and performs resize after insertion. - # * compute_if_absent prescans for mapping without lock (and fails to add - # if present), which also makes pre-emptive resize checks worthwhile. - # - # Someday when details settle down a bit more, it might be worth - # some factoring to reduce sprawl. - def internal_replace(key, expected_old_value = NULL, &block) - hash = key_hash(key) - current_table = table - while current_table - if !(node = current_table.volatile_get(i = current_table.hash_to_index(hash))) - break - elsif (node_hash = node.hash) == MOVED - current_table = node.key - elsif (node_hash & HASH_BITS) != hash && !node.next # precheck - break # rules out possible existence - elsif Node.locked_hash?(node_hash) - try_await_lock(current_table, i, node) - else - succeeded, old_value = attempt_internal_replace(key, expected_old_value, hash, current_table, i, node, node_hash, &block) - return old_value if succeeded - end - end - NULL - end - - def attempt_internal_replace(key, expected_old_value, hash, current_table, i, node, node_hash) - current_table.try_lock_via_hash(i, node, node_hash) do - predecessor_node = nil - old_value = NULL - begin - if node.matches?(key, hash) && NULL != (current_value = node.value) - if NULL == expected_old_value || expected_old_value == current_value # NULL == expected_old_value means whatever value - old_value = current_value - if NULL == (node.value = yield(old_value)) - current_table.delete_node_at(i, node, predecessor_node) - decrement_size - end - end - break - end - - predecessor_node = node - end while node = node.next - - return true, old_value - end - end - - def find_value_in_node_list(node, key, hash, pure_hash) - do_check_for_resize = false - while true - if pure_hash == hash && node.key?(key) && NULL != (value = node.value) - return value - elsif node = node.next - do_check_for_resize = true # at least 2 nodes -> check for resize - pure_hash = node.pure_hash - else - return NULL - end - end - ensure - check_for_resize if do_check_for_resize - end - - def internal_compute(key, &block) - hash = key_hash(key) - current_table = table || initialize_table - while true - if !(node = current_table.volatile_get(i = current_table.hash_to_index(hash))) - succeeded, new_value = current_table.try_to_cas_in_computed(i, hash, key, &block) - if succeeded - if NULL == new_value - break nil - else - increment_size - break new_value - end - end - elsif (node_hash = node.hash) == MOVED - current_table = node.key - elsif Node.locked_hash?(node_hash) - try_await_lock(current_table, i, node) - else - succeeded, new_value = attempt_compute(key, hash, current_table, i, node, node_hash, &block) - break new_value if succeeded - end - end - end - - def attempt_internal_compute_if_absent(key, hash, current_table, i, node, node_hash) - added = false - current_table.try_lock_via_hash(i, node, node_hash) do - while true - if node.matches?(key, hash) && NULL != (value = node.value) - return true, value - end - last = node - unless node = node.next - last.next = Node.new(hash, key, value = yield) - added = true - increment_size - return true, value - end - end - end - ensure - check_for_resize if added - end - - def attempt_compute(key, hash, current_table, i, node, node_hash) - added = false - current_table.try_lock_via_hash(i, node, node_hash) do - predecessor_node = nil - while true - if node.matches?(key, hash) && NULL != (value = node.value) - if NULL == (node.value = value = yield(value)) - current_table.delete_node_at(i, node, predecessor_node) - decrement_size - value = nil - end - return true, value - end - predecessor_node = node - unless node = node.next - if NULL == (value = yield(NULL)) - value = nil - else - predecessor_node.next = Node.new(hash, key, value) - added = true - increment_size - end - return true, value - end - end - end - ensure - check_for_resize if added - end - - def attempt_get_and_set(key, value, hash, current_table, i, node, node_hash) - node_nesting = nil - current_table.try_lock_via_hash(i, node, node_hash) do - node_nesting = 1 - old_value = nil - found_old_value = false - while node - if node.matches?(key, hash) && NULL != (old_value = node.value) - found_old_value = true - node.value = value - break - end - last = node - unless node = node.next - last.next = Node.new(hash, key, value) - break - end - node_nesting += 1 - end - - return true, old_value if found_old_value - increment_size - true - end - ensure - check_for_resize if node_nesting && (node_nesting > 1 || current_table.size <= 64) - end - - def initialize_copy(other) - super - @counter = Util::Adder.new - self.table = nil - self.size_control = (other_table = other.table) ? other_table.size : DEFAULT_CAPACITY - self - end - - def try_await_lock(current_table, i, node) - check_for_resize # try resizing if can't get lock - node.try_await_lock(current_table, i) - end - - def key_hash(key) - key.hash & HASH_BITS - end - - # Returns a power of two table size for the given desired capacity. - def table_size_for(entry_count) - size = 2 - size <<= 1 while size < entry_count - size - end - - # Initializes table, using the size recorded in +size_control+. - def initialize_table - until current_table ||= table - if (size_ctrl = size_control) == NOW_RESIZING - Thread.pass # lost initialization race; just spin - else - try_in_resize_lock(current_table, size_ctrl) do - initial_size = size_ctrl > 0 ? size_ctrl : DEFAULT_CAPACITY - current_table = self.table = Table.new(initial_size) - initial_size - (initial_size >> 2) # 75% load factor - end - end - end - current_table - end - - # If table is too small and not already resizing, creates next table and - # transfers bins. Rechecks occupancy after a transfer to see if another - # resize is already needed because resizings are lagging additions. - def check_for_resize - while (current_table = table) && MAX_CAPACITY > (table_size = current_table.size) && NOW_RESIZING != (size_ctrl = size_control) && size_ctrl < @counter.sum - try_in_resize_lock(current_table, size_ctrl) do - self.table = rebuild(current_table) - (table_size << 1) - (table_size >> 1) # 75% load factor - end - end - end - - def try_in_resize_lock(current_table, size_ctrl) - if cas_size_control(size_ctrl, NOW_RESIZING) - begin - if current_table == table # recheck under lock - size_ctrl = yield # get new size_control - end - ensure - self.size_control = size_ctrl - end - end - end - - # Moves and/or copies the nodes in each bin to new table. See above for explanation. - def rebuild(table) - old_table_size = table.size - new_table = table.next_in_size_table - # puts "#{old_table_size} -> #{new_table.size}" - forwarder = Node.new(MOVED, new_table, NULL) - rev_forwarder = nil - locked_indexes = nil # holds bins to revisit; nil until needed - locked_arr_idx = 0 - bin = old_table_size - 1 - i = bin - while true - if !(node = table.volatile_get(i)) - # no lock needed (or available) if bin >= 0, because we're not popping values from locked_indexes until we've run through the whole table - redo unless (bin >= 0 ? table.cas(i, nil, forwarder) : lock_and_clean_up_reverse_forwarders(table, old_table_size, new_table, i, forwarder)) - elsif Node.locked_hash?(node_hash = node.hash) - locked_indexes ||= Array.new - if bin < 0 && locked_arr_idx > 0 - locked_arr_idx -= 1 - i, locked_indexes[locked_arr_idx] = locked_indexes[locked_arr_idx], i # swap with another bin - redo - end - if bin < 0 || locked_indexes.size >= TRANSFER_BUFFER_SIZE - node.try_await_lock(table, i) # no other options -- block - redo - end - rev_forwarder ||= Node.new(MOVED, table, NULL) - redo unless table.volatile_get(i) == node && node.locked? # recheck before adding to list - locked_indexes << i - new_table.volatile_set(i, rev_forwarder) - new_table.volatile_set(i + old_table_size, rev_forwarder) - else - redo unless split_old_bin(table, new_table, i, node, node_hash, forwarder) - end - - if bin > 0 - i = (bin -= 1) - elsif locked_indexes && !locked_indexes.empty? - bin = -1 - i = locked_indexes.pop - locked_arr_idx = locked_indexes.size - 1 - else - return new_table - end - end - end - - def lock_and_clean_up_reverse_forwarders(old_table, old_table_size, new_table, i, forwarder) - # transiently use a locked forwarding node - locked_forwarder = Node.new(moved_locked_hash = MOVED | LOCKED, new_table, NULL) - if old_table.cas(i, nil, locked_forwarder) - new_table.volatile_set(i, nil) # kill the potential reverse forwarders - new_table.volatile_set(i + old_table_size, nil) # kill the potential reverse forwarders - old_table.volatile_set(i, forwarder) - locked_forwarder.unlock_via_hash(moved_locked_hash, MOVED) - true - end - end - - # Splits a normal bin with list headed by e into lo and hi parts; installs in given table. - def split_old_bin(table, new_table, i, node, node_hash, forwarder) - table.try_lock_via_hash(i, node, node_hash) do - split_bin(new_table, i, node, node_hash) - table.volatile_set(i, forwarder) - end - end - - def split_bin(new_table, i, node, node_hash) - bit = new_table.size >> 1 # bit to split on - run_bit = node_hash & bit - last_run = nil - low = nil - high = nil - current_node = node - # this optimises for the lowest amount of volatile writes and objects created - while current_node = current_node.next - unless (b = current_node.hash & bit) == run_bit - run_bit = b - last_run = current_node - end - end - if run_bit == 0 - low = last_run - else - high = last_run - end - current_node = node - until current_node == last_run - pure_hash = current_node.pure_hash - if (pure_hash & bit) == 0 - low = Node.new(pure_hash, current_node.key, current_node.value, low) - else - high = Node.new(pure_hash, current_node.key, current_node.value, high) - end - current_node = current_node.next - end - new_table.volatile_set(i, low) - new_table.volatile_set(i + bit, high) - end - - def increment_size - @counter.increment - end - - def decrement_size(by = 1) - @counter.add(-by) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/cache.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/cache.rb deleted file mode 100644 index 265c0e5e33..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/cache.rb +++ /dev/null @@ -1,161 +0,0 @@ -require 'thread' - -module ThreadSafe - autoload :JRubyCacheBackend, 'thread_safe/jruby_cache_backend' - autoload :MriCacheBackend, 'thread_safe/mri_cache_backend' - autoload :NonConcurrentCacheBackend, 'thread_safe/non_concurrent_cache_backend' - autoload :AtomicReferenceCacheBackend, 'thread_safe/atomic_reference_cache_backend' - autoload :SynchronizedCacheBackend, 'thread_safe/synchronized_cache_backend' - - ConcurrentCacheBackend = if defined?(RUBY_ENGINE) - case RUBY_ENGINE - when 'jruby'; JRubyCacheBackend - when 'ruby'; MriCacheBackend - when 'rbx'; AtomicReferenceCacheBackend - else - warn 'ThreadSafe: unsupported Ruby engine, using a fully synchronized ThreadSafe::Cache implementation' if $VERBOSE - SynchronizedCacheBackend - end - else - MriCacheBackend - end - - class Cache < ConcurrentCacheBackend - def initialize(options = nil, &block) - if options.kind_of?(::Hash) - validate_options_hash!(options) - else - options = nil - end - - super(options) - @default_proc = block - end - - def [](key) - if value = super # non-falsy value is an existing mapping, return it right away - value - # re-check is done with get_or_default(key, NULL) instead of a simple !key?(key) in order to avoid a race condition, whereby by the time the current thread gets to the key?(key) call - # a key => value mapping might have already been created by a different thread (key?(key) would then return true, this elsif branch wouldn't be taken and an incorrent +nil+ value - # would be returned) - # note: nil == value check is not technically necessary - elsif @default_proc && nil == value && NULL == (value = get_or_default(key, NULL)) - @default_proc.call(self, key) - else - value - end - end - - alias_method :get, :[] - alias_method :put, :[]= - - def fetch(key, default_value = NULL) - if NULL != (value = get_or_default(key, NULL)) - value - elsif block_given? - yield key - elsif NULL != default_value - default_value - else - raise_fetch_no_key - end - end - - def fetch_or_store(key, default_value = NULL) - fetch(key) do - put(key, block_given? ? yield(key) : (NULL == default_value ? raise_fetch_no_key : default_value)) - end - end - - def put_if_absent(key, value) - computed = false - result = compute_if_absent(key) do - computed = true - value - end - computed ? nil : result - end unless method_defined?(:put_if_absent) - - def value?(value) - each_value do |v| - return true if value.equal?(v) - end - false - end unless method_defined?(:value?) - - def keys - arr = [] - each_pair {|k, v| arr << k} - arr - end unless method_defined?(:keys) - - def values - arr = [] - each_pair {|k, v| arr << v} - arr - end unless method_defined?(:values) - - def each_key - each_pair {|k, v| yield k} - end unless method_defined?(:each_key) - - def each_value - each_pair {|k, v| yield v} - end unless method_defined?(:each_value) - - def key(value) - each_pair {|k, v| return k if v == value} - nil - end unless method_defined?(:key) - alias_method :index, :key if RUBY_VERSION < '1.9' - - def empty? - each_pair {|k, v| return false} - true - end unless method_defined?(:empty?) - - def size - count = 0 - each_pair {|k, v| count += 1} - count - end unless method_defined?(:size) - - def marshal_dump - raise TypeError, "can't dump hash with default proc" if @default_proc - h = {} - each_pair {|k, v| h[k] = v} - h - end - - def marshal_load(hash) - initialize - populate_from(hash) - end - - undef :freeze - - private - def raise_fetch_no_key - raise KeyError, 'key not found' - end - - def initialize_copy(other) - super - populate_from(other) - end - - def populate_from(hash) - hash.each_pair {|k, v| self[k] = v} - self - end - - def validate_options_hash!(options) - if (initial_capacity = options[:initial_capacity]) && (!initial_capacity.kind_of?(0.class) || initial_capacity < 0) - raise ArgumentError, ":initial_capacity must be a positive #{0.class}" - end - if (load_factor = options[:load_factor]) && (!load_factor.kind_of?(Numeric) || load_factor <= 0 || load_factor > 1) - raise ArgumentError, ":load_factor must be a number between 0 and 1" - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/mri_cache_backend.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/mri_cache_backend.rb deleted file mode 100644 index 13e57b335a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/mri_cache_backend.rb +++ /dev/null @@ -1,60 +0,0 @@ -module ThreadSafe - class MriCacheBackend < NonConcurrentCacheBackend - # We can get away with a single global write lock (instead of a per-instance - # one) because of the GVL/green threads. - # - # NOTE: a neat idea of writing a c-ext to manually perform atomic - # put_if_absent, while relying on Ruby not releasing a GVL while calling a - # c-ext will not work because of the potentially Ruby implemented `#hash` - # and `#eql?` key methods. - WRITE_LOCK = Mutex.new - - def []=(key, value) - WRITE_LOCK.synchronize { super } - end - - def compute_if_absent(key) - if stored_value = _get(key) # fast non-blocking path for the most likely case - stored_value - else - WRITE_LOCK.synchronize { super } - end - end - - def compute_if_present(key) - WRITE_LOCK.synchronize { super } - end - - def compute(key) - WRITE_LOCK.synchronize { super } - end - - def merge_pair(key, value) - WRITE_LOCK.synchronize { super } - end - - def replace_pair(key, old_value, new_value) - WRITE_LOCK.synchronize { super } - end - - def replace_if_exists(key, new_value) - WRITE_LOCK.synchronize { super } - end - - def get_and_set(key, value) - WRITE_LOCK.synchronize { super } - end - - def delete(key) - WRITE_LOCK.synchronize { super } - end - - def delete_pair(key, value) - WRITE_LOCK.synchronize { super } - end - - def clear - WRITE_LOCK.synchronize { super } - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/non_concurrent_cache_backend.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/non_concurrent_cache_backend.rb deleted file mode 100644 index 111ae63e58..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/non_concurrent_cache_backend.rb +++ /dev/null @@ -1,135 +0,0 @@ -module ThreadSafe - class NonConcurrentCacheBackend - # WARNING: all public methods of the class must operate on the @backend - # directly without calling each other. This is important because of the - # SynchronizedCacheBackend which uses a non-reentrant mutex for perfomance - # reasons. - def initialize(options = nil) - @backend = {} - end - - def [](key) - @backend[key] - end - - def []=(key, value) - @backend[key] = value - end - - def compute_if_absent(key) - if NULL != (stored_value = @backend.fetch(key, NULL)) - stored_value - else - @backend[key] = yield - end - end - - def replace_pair(key, old_value, new_value) - if pair?(key, old_value) - @backend[key] = new_value - true - else - false - end - end - - def replace_if_exists(key, new_value) - if NULL != (stored_value = @backend.fetch(key, NULL)) - @backend[key] = new_value - stored_value - end - end - - def compute_if_present(key) - if NULL != (stored_value = @backend.fetch(key, NULL)) - store_computed_value(key, yield(stored_value)) - end - end - - def compute(key) - store_computed_value(key, yield(@backend[key])) - end - - def merge_pair(key, value) - if NULL == (stored_value = @backend.fetch(key, NULL)) - @backend[key] = value - else - store_computed_value(key, yield(stored_value)) - end - end - - def get_and_set(key, value) - stored_value = @backend[key] - @backend[key] = value - stored_value - end - - def key?(key) - @backend.key?(key) - end - - def value?(value) - @backend.value?(value) - end - - def delete(key) - @backend.delete(key) - end - - def delete_pair(key, value) - if pair?(key, value) - @backend.delete(key) - true - else - false - end - end - - def clear - @backend.clear - self - end - - def each_pair - dupped_backend.each_pair do |k, v| - yield k, v - end - self - end - - def size - @backend.size - end - - def get_or_default(key, default_value) - @backend.fetch(key, default_value) - end - - alias_method :_get, :[] - alias_method :_set, :[]= - private :_get, :_set - private - def initialize_copy(other) - super - @backend = {} - self - end - - def dupped_backend - @backend.dup - end - - def pair?(key, expected_value) - NULL != (stored_value = @backend.fetch(key, NULL)) && expected_value.equal?(stored_value) - end - - def store_computed_value(key, new_value) - if new_value.nil? - @backend.delete(key) - nil - else - @backend[key] = new_value - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/synchronized_cache_backend.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/synchronized_cache_backend.rb deleted file mode 100644 index 2af3b8cf78..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/synchronized_cache_backend.rb +++ /dev/null @@ -1,77 +0,0 @@ -module ThreadSafe - class SynchronizedCacheBackend < NonConcurrentCacheBackend - require 'mutex_m' - include Mutex_m - # WARNING: Mutex_m is a non-reentrant lock, so the synchronized methods are - # not allowed to call each other. - - def [](key) - synchronize { super } - end - - def []=(key, value) - synchronize { super } - end - - def compute_if_absent(key) - synchronize { super } - end - - def compute_if_present(key) - synchronize { super } - end - - def compute(key) - synchronize { super } - end - - def merge_pair(key, value) - synchronize { super } - end - - def replace_pair(key, old_value, new_value) - synchronize { super } - end - - def replace_if_exists(key, new_value) - synchronize { super } - end - - def get_and_set(key, value) - synchronize { super } - end - - def key?(key) - synchronize { super } - end - - def value?(value) - synchronize { super } - end - - def delete(key) - synchronize { super } - end - - def delete_pair(key, value) - synchronize { super } - end - - def clear - synchronize { super } - end - - def size - synchronize { super } - end - - def get_or_default(key, default_value) - synchronize { super } - end - - private - def dupped_backend - synchronize { super } - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/synchronized_delegator.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/synchronized_delegator.rb deleted file mode 100644 index 2fc351d91e..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/synchronized_delegator.rb +++ /dev/null @@ -1,43 +0,0 @@ -require 'delegate' -require 'monitor' - -# This class provides a trivial way to synchronize all calls to a given object -# by wrapping it with a `Delegator` that performs `Monitor#enter/exit` calls -# around the delegated `#send`. Example: -# -# array = [] # not thread-safe on many impls -# array = SynchronizedDelegator.new([]) # thread-safe -# -# A simple `Monitor` provides a very coarse-grained way to synchronize a given -# object, in that it will cause synchronization for methods that have no need -# for it, but this is a trivial way to get thread-safety where none may exist -# currently on some implementations. -# -# This class is currently being considered for inclusion into stdlib, via -# https://bugs.ruby-lang.org/issues/8556 -class SynchronizedDelegator < SimpleDelegator - def setup - @old_abort = Thread.abort_on_exception - Thread.abort_on_exception = true - end - - def teardown - Thread.abort_on_exception = @old_abort - end - - def initialize(obj) - __setobj__(obj) - @monitor = Monitor.new - end - - def method_missing(method, *args, &block) - monitor = @monitor - begin - monitor.enter - super - ensure - monitor.exit - end - end - -end unless defined?(SynchronizedDelegator) diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/util.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/util.rb deleted file mode 100644 index bad423889f..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/util.rb +++ /dev/null @@ -1,16 +0,0 @@ -module ThreadSafe - module Util - FIXNUM_BIT_SIZE = (0.size * 8) - 2 - MAX_INT = (2 ** FIXNUM_BIT_SIZE) - 1 - CPU_COUNT = 16 # is there a way to determine this? - - autoload :AtomicReference, 'thread_safe/util/atomic_reference' - autoload :Adder, 'thread_safe/util/adder' - autoload :CheapLockable, 'thread_safe/util/cheap_lockable' - autoload :PowerOfTwoTuple, 'thread_safe/util/power_of_two_tuple' - autoload :Striped64, 'thread_safe/util/striped64' - autoload :Volatile, 'thread_safe/util/volatile' - autoload :VolatileTuple, 'thread_safe/util/volatile_tuple' - autoload :XorShiftRandom, 'thread_safe/util/xor_shift_random' - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/version.rb deleted file mode 100644 index 88821f6dc7..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/thread_safe-0.3.6/lib/thread_safe/version.rb +++ /dev/null @@ -1,21 +0,0 @@ -module ThreadSafe - VERSION = "0.3.6" -end - -# NOTE: <= 0.2.0 used Threadsafe::VERSION -# @private -module Threadsafe - - # @private - def self.const_missing(name) - name = name.to_sym - if ThreadSafe.const_defined?(name) - warn "[DEPRECATION] `Threadsafe::#{name}' is deprecated, use `ThreadSafe::#{name}' instead." - ThreadSafe.const_get(name) - else - warn "[DEPRECATION] the `Threadsafe' module is deprecated, please use `ThreadSafe` instead." - super - end - end - -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo.rb deleted file mode 100644 index 7a11ef77e6..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo.rb +++ /dev/null @@ -1,43 +0,0 @@ -# Top level module for TZInfo. -module TZInfo -end - -require 'tzinfo/ruby_core_support' -require 'tzinfo/offset_rationals' -require 'tzinfo/time_or_datetime' - -require 'tzinfo/timezone_definition' - -require 'tzinfo/timezone_offset' -require 'tzinfo/timezone_transition' -require 'tzinfo/transition_rule' -require 'tzinfo/annual_rules' -require 'tzinfo/timezone_transition_definition' - -require 'tzinfo/timezone_index_definition' - -require 'tzinfo/timezone_info' -require 'tzinfo/data_timezone_info' -require 'tzinfo/linked_timezone_info' -require 'tzinfo/transition_data_timezone_info' -require 'tzinfo/zoneinfo_timezone_info' - -require 'tzinfo/data_source' -require 'tzinfo/ruby_data_source' -require 'tzinfo/posix_time_zone_parser' -require 'tzinfo/zoneinfo_data_source' - -require 'tzinfo/timezone_period' -require 'tzinfo/timezone' -require 'tzinfo/info_timezone' -require 'tzinfo/data_timezone' -require 'tzinfo/linked_timezone' -require 'tzinfo/timezone_proxy' - -require 'tzinfo/country_index_definition' -require 'tzinfo/country_info' -require 'tzinfo/ruby_country_info' -require 'tzinfo/zoneinfo_country_info' - -require 'tzinfo/country' -require 'tzinfo/country_timezone' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/annual_rules.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/annual_rules.rb deleted file mode 100644 index fec436b7a2..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/annual_rules.rb +++ /dev/null @@ -1,51 +0,0 @@ -module TZInfo - # A set of rules that define when transitions occur in time zones with - # annually occurring daylight savings time. - # - # @private - class AnnualRules #:nodoc: - # Returned by #transitions. #offset is the TimezoneOffset that applies - # from the UTC TimeOrDateTime #at. #previous_offset is the prior - # TimezoneOffset. - Transition = Struct.new(:offset, :previous_offset, :at) - - # The standard offset that applies when daylight savings time is not in - # force. - attr_reader :std_offset - - # The offset that applies when daylight savings time is in force. - attr_reader :dst_offset - - # The rule that determines when daylight savings time starts. - attr_reader :dst_start_rule - - # The rule that determines when daylight savings time ends. - attr_reader :dst_end_rule - - # Initializes a new {AnnualRules} instance. - def initialize(std_offset, dst_offset, dst_start_rule, dst_end_rule) - @std_offset = std_offset - @dst_offset = dst_offset - @dst_start_rule = dst_start_rule - @dst_end_rule = dst_end_rule - end - - # Returns the transitions between standard and daylight savings time for a - # given year. The results are ordered by time of occurrence (earliest to - # latest). - def transitions(year) - start_dst = apply_rule(@dst_start_rule, @std_offset, @dst_offset, year) - end_dst = apply_rule(@dst_end_rule, @dst_offset, @std_offset, year) - - end_dst.at < start_dst.at ? [end_dst, start_dst] : [start_dst, end_dst] - end - - private - - # Applies a given rule between offsets on a year. - def apply_rule(rule, from_offset, to_offset, year) - at = rule.at(from_offset, year) - Transition.new(to_offset, from_offset, at) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/country.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/country.rb deleted file mode 100644 index 0dccebd5c9..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/country.rb +++ /dev/null @@ -1,196 +0,0 @@ -require 'thread_safe' - -module TZInfo - # Raised by Country#get if the code given is not valid. - class InvalidCountryCode < StandardError - end - - # The Country class represents an ISO 3166-1 country. It can be used to - # obtain a list of Timezones for a country. For example: - # - # us = Country.get('US') - # us.zone_identifiers - # us.zones - # us.zone_info - # - # The Country class is thread-safe. It is safe to use class and instance - # methods of Country in concurrently executing threads. Instances of Country - # can be shared across thread boundaries. - # - # Country information available through TZInfo is intended as an aid for - # users, to help them select time zone data appropriate for their practical - # needs. It is not intended to take or endorse any position on legal or - # territorial claims. - class Country - include Comparable - - # Defined countries. - # - # @!visibility private - @@countries = nil - - # Whether the countries index has been loaded yet. - # - # @!visibility private - @@index_loaded = false - - # Gets a Country by its ISO 3166-1 alpha-2 code. Raises an - # InvalidCountryCode exception if it couldn't be found. - def self.get(identifier) - instance = @@countries[identifier] - - unless instance - # Thread-safety: It is possible that multiple equivalent Country - # instances could be created here in concurrently executing threads. - # The consequences of this are that the data may be loaded more than - # once (depending on the data source) and memoized calculations could - # be discarded. The performance benefit of ensuring that only a single - # instance is created is unlikely to be worth the overhead of only - # allowing one Country to be loaded at a time. - info = data_source.load_country_info(identifier) - instance = Country.new(info) - @@countries[identifier] = instance - end - - instance - end - - # If identifier is a CountryInfo object, initializes the Country instance, - # otherwise calls get(identifier). - def self.new(identifier) - if identifier.kind_of?(CountryInfo) - instance = super() - instance.send :setup, identifier - instance - else - get(identifier) - end - end - - # Returns an Array of all the valid country codes. - def self.all_codes - data_source.country_codes - end - - # Returns an Array of all the defined Countries. - def self.all - data_source.country_codes.collect {|code| get(code)} - end - - # The ISO 3166-1 alpha-2 country code. - def code - @info.code - end - - # The name of the country. - def name - @info.name - end - - # Alias for name. - def to_s - name - end - - # Returns internal object state as a programmer-readable string. - def inspect - "#<#{self.class}: #{@info.code}>" - end - - # Returns a frozen array of all the zone identifiers for the country. These - # are in an order that - # - # 1. makes some geographical sense, and - # 2. puts the most populous zones first, where that does not contradict 1. - # - # Returned zone identifiers may refer to cities and regions outside of the - # country. This will occur if the zone covers multiple countries. Any zones - # referring to a city or region in a different country will be listed after - # those relating to this country. - def zone_identifiers - @info.zone_identifiers - end - alias zone_names zone_identifiers - - # An array of all the Timezones for this country. Returns TimezoneProxy - # objects to avoid the overhead of loading Timezone definitions until - # a conversion is actually required. The Timezones are returned in an order - # that - # - # 1. makes some geographical sense, and - # 2. puts the most populous zones first, where that does not contradict 1. - # - # Identifiers of the zones returned may refer to cities and regions outside - # of the country. This will occur if the zone covers multiple countries. Any - # zones referring to a city or region in a different country will be listed - # after those relating to this country. - def zones - zone_identifiers.collect {|id| - Timezone.get_proxy(id) - } - end - - # Returns a frozen array of all the timezones for the for the country as - # CountryTimezone instances (containing extra information about each zone). - # These are in an order that - # - # 1. makes some geographical sense, and - # 2. puts the most populous zones first, where that does not contradict 1. - # - # Identifiers and descriptions of the zones returned may refer to cities and - # regions outside of the country. This will occur if the zone covers - # multiple countries. Any zones referring to a city or region in a different - # country will be listed after those relating to this country. - def zone_info - @info.zones - end - - # Compare two Countries based on their code. Returns -1 if c is less - # than self, 0 if c is equal to self and +1 if c is greater than self. - # - # Returns nil if c is not comparable with Country instances. - def <=>(c) - return nil unless c.is_a?(Country) - code <=> c.code - end - - # Returns true if and only if the code of c is equal to the code of this - # Country. - def eql?(c) - self == c - end - - # Returns a hash value for this Country. - def hash - code.hash - end - - # Dumps this Country for marshalling. - def _dump(limit) - code - end - - # Loads a marshalled Country. - def self._load(data) - Country.get(data) - end - - private - # Called by Country.new to initialize a new Country instance. The info - # parameter is a CountryInfo that defines the country. - def setup(info) - @info = info - end - - # Initializes @@countries. - def self.init_countries - @@countries = ThreadSafe::Cache.new - end - init_countries - - # Returns the current DataSource - def self.data_source - DataSource.get - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/country_index_definition.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/country_index_definition.rb deleted file mode 100644 index 431790b3d1..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/country_index_definition.rb +++ /dev/null @@ -1,31 +0,0 @@ -module TZInfo - # The country index file includes CountryIndexDefinition which provides - # a country method used to define each country in the index. - # - # @private - module CountryIndexDefinition #:nodoc: - def self.append_features(base) - super - base.extend(ClassMethods) - base.instance_eval { @countries = {} } - end - - # Class methods for inclusion. - # - # @private - module ClassMethods #:nodoc: - # Defines a country with an ISO 3166 country code, name and block. The - # block will be evaluated to obtain all the timezones for the country. - # Calls Country.country_defined with the definition of each country. - def country(code, name, &block) - @countries[code] = RubyCountryInfo.new(code, name, &block) - end - - # Returns a frozen hash of all the countries that have been defined in - # the index. - def countries - @countries.freeze - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/country_info.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/country_info.rb deleted file mode 100644 index e9d71c7719..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/country_info.rb +++ /dev/null @@ -1,42 +0,0 @@ -module TZInfo - # Represents a country and references to its timezones as returned by a - # DataSource. - class CountryInfo - # The ISO 3166 country code. - attr_reader :code - - # The name of the country. - attr_reader :name - - # Constructs a new CountryInfo with an ISO 3166 country code and name - def initialize(code, name) - @code = code - @name = name - end - - # Returns internal object state as a programmer-readable string. - def inspect - "#<#{self.class}: #@code>" - end - - # Returns a frozen array of all the zone identifiers for the country. - # The identifiers are ordered by importance according to the DataSource. - def zone_identifiers - raise_not_implemented('zone_identifiers') - end - - # Returns a frozen array of all the timezones for the for the country as - # CountryTimezone instances. - # - # The timezones are ordered by importance according to the DataSource. - def zones - raise_not_implemented('zones') - end - - private - - def raise_not_implemented(method_name) - raise NotImplementedError, "Subclasses must override #{method_name}" - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/country_timezone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/country_timezone.rb deleted file mode 100644 index d46bec0d05..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/country_timezone.rb +++ /dev/null @@ -1,135 +0,0 @@ -module TZInfo - # A Timezone within a Country. This contains extra information about the - # Timezone that is specific to the Country (a Timezone could be used by - # multiple countries). - class CountryTimezone - # The zone identifier. - attr_reader :identifier - - # A description of this timezone in relation to the country, e.g. - # "Eastern Time". This is usually nil for countries having only a single - # Timezone. - attr_reader :description - - class << self - # Creates a new CountryTimezone with a timezone identifier, latitude, - # longitude and description. The latitude and longitude are specified as - # rationals - a numerator and denominator. For performance reasons, the - # numerators and denominators must be specified in their lowest form. - # - # For use internally within TZInfo. - # - # @!visibility private - alias :new! :new - - # Creates a new CountryTimezone with a timezone identifier, latitude, - # longitude and description. The latitude and longitude must be specified - # as instances of Rational. - # - # CountryTimezone instances should normally only be constructed when - # creating new DataSource implementations. - def new(identifier, latitude, longitude, description = nil) - super(identifier, latitude, nil, longitude, nil, description) - end - end - - # Creates a new CountryTimezone with a timezone identifier, latitude, - # longitude and description. The latitude and longitude are specified as - # rationals - a numerator and denominator. For performance reasons, the - # numerators and denominators must be specified in their lowest form. - # - # @!visibility private - def initialize(identifier, latitude_numerator, latitude_denominator, - longitude_numerator, longitude_denominator, description = nil) #:nodoc: - @identifier = identifier - - if latitude_numerator.kind_of?(Rational) - @latitude = latitude_numerator - else - @latitude = nil - @latitude_numerator = latitude_numerator - @latitude_denominator = latitude_denominator - end - - if longitude_numerator.kind_of?(Rational) - @longitude = longitude_numerator - else - @longitude = nil - @longitude_numerator = longitude_numerator - @longitude_denominator = longitude_denominator - end - - @description = description - end - - # The Timezone (actually a TimezoneProxy for performance reasons). - def timezone - Timezone.get_proxy(@identifier) - end - - # if description is not nil, this method returns description; otherwise it - # returns timezone.friendly_identifier(true). - def description_or_friendly_identifier - description || timezone.friendly_identifier(true) - end - - # The latitude of this timezone in degrees as a Rational. - def latitude - # Thread-safety: It is possible that the value of @latitude may be - # calculated multiple times in concurrently executing threads. It is not - # worth the overhead of locking to ensure that @latitude is only - # calculated once. - unless @latitude - result = RubyCoreSupport.rational_new!(@latitude_numerator, @latitude_denominator) - return result if frozen? - @latitude = result - end - - @latitude - end - - # The longitude of this timezone in degrees as a Rational. - def longitude - # Thread-safety: It is possible that the value of @longitude may be - # calculated multiple times in concurrently executing threads. It is not - # worth the overhead of locking to ensure that @longitude is only - # calculated once. - unless @longitude - result = RubyCoreSupport.rational_new!(@longitude_numerator, @longitude_denominator) - return result if frozen? - @longitude = result - end - - @longitude - end - - # Returns true if and only if the given CountryTimezone is equal to the - # current CountryTimezone (has the same identifer, latitude, longitude - # and description). - def ==(ct) - ct.kind_of?(CountryTimezone) && - identifier == ct.identifier && latitude == ct.latitude && - longitude == ct.longitude && description == ct.description - end - - # Returns true if and only if the given CountryTimezone is equal to the - # current CountryTimezone (has the same identifer, latitude, longitude - # and description). - def eql?(ct) - self == ct - end - - # Returns a hash of this CountryTimezone. - def hash - @identifier.hash ^ - (@latitude ? @latitude.numerator.hash ^ @latitude.denominator.hash : @latitude_numerator.hash ^ @latitude_denominator.hash) ^ - (@longitude ? @longitude.numerator.hash ^ @longitude.denominator.hash : @longitude_numerator.hash ^ @longitude_denominator.hash) ^ - @description.hash - end - - # Returns internal object state as a programmer-readable string. - def inspect - "#<#{self.class}: #@identifier>" - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/data_source.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/data_source.rb deleted file mode 100644 index c5deeac929..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/data_source.rb +++ /dev/null @@ -1,190 +0,0 @@ -require 'thread' - -module TZInfo - # InvalidDataSource is raised if the DataSource is used doesn't implement one - # of the required methods. - class InvalidDataSource < StandardError - end - - # DataSourceNotFound is raised if no data source could be found (i.e. - # if 'tzinfo/data' cannot be found on the load path and no valid zoneinfo - # directory can be found on the system). - class DataSourceNotFound < StandardError - end - - # The base class for data sources of timezone and country data. - # - # Use DataSource.set to change the data source being used. - class DataSource - # The currently selected data source. - @@instance = nil - - # Mutex used to ensure the default data source is only created once. - @@default_mutex = Mutex.new - - # Returns the currently selected DataSource instance. - def self.get - # If a DataSource hasn't been manually set when the first request is - # made to obtain a DataSource, then a Default data source is created. - - # This is done at the first request rather than when TZInfo is loaded to - # avoid unnecessary (or in some cases potentially harmful) attempts to - # find a suitable DataSource. - - # A Mutex is used to ensure that only a single default instance is - # created (having two different DataSources in use simultaneously could - # cause unexpected results). - - unless @@instance - @@default_mutex.synchronize do - set(create_default_data_source) unless @@instance - end - end - - @@instance - end - - # Sets the currently selected data source for Timezone and Country data. - # - # This should usually be set to one of the two standard data source types: - # - # * +:ruby+ - read data from the Ruby modules included in the TZInfo::Data - # library (tzinfo-data gem). - # * +:zoneinfo+ - read data from the zoneinfo files included with most - # Unix-like operating sytems (e.g. in /usr/share/zoneinfo). - # - # To set TZInfo to use one of the standard data source types, call - # \TZInfo::DataSource.set in one of the following ways: - # - # TZInfo::DataSource.set(:ruby) - # TZInfo::DataSource.set(:zoneinfo) - # TZInfo::DataSource.set(:zoneinfo, zoneinfo_dir) - # TZInfo::DataSource.set(:zoneinfo, zoneinfo_dir, iso3166_tab_file) - # - # \DataSource.set(:zoneinfo) will automatically search for the zoneinfo - # directory by checking the paths specified in - # ZoneinfoDataSource.search_paths. ZoneinfoDirectoryNotFound will be raised - # if no valid zoneinfo directory could be found. - # - # \DataSource.set(:zoneinfo, zoneinfo_dir) uses the specified zoneinfo - # directory as the data source. If the directory is not a valid zoneinfo - # directory, an InvalidZoneinfoDirectory exception will be raised. - # - # \DataSource.set(:zoneinfo, zoneinfo_dir, iso3166_tab_file) uses the - # specified zoneinfo directory as the data source, but loads the iso3166.tab - # file from an alternate path. If the directory is not a valid zoneinfo - # directory, an InvalidZoneinfoDirectory exception will be raised. - # - # Custom data sources can be created by subclassing TZInfo::DataSource and - # implementing the following methods: - # - # * \load_timezone_info - # * \timezone_identifiers - # * \data_timezone_identifiers - # * \linked_timezone_identifiers - # * \load_country_info - # * \country_codes - # - # To have TZInfo use the custom data source, call \DataSource.set - # as follows: - # - # TZInfo::DataSource.set(CustomDataSource.new) - # - # To avoid inconsistent data, \DataSource.set should be called before - # accessing any Timezone or Country data. - # - # If \DataSource.set is not called, TZInfo will by default use TZInfo::Data - # as the data source. If TZInfo::Data is not available (i.e. if require - # 'tzinfo/data' fails), then TZInfo will search for a zoneinfo directory - # instead (using the search path specified by - # TZInfo::ZoneinfoDataSource::DEFAULT_SEARCH_PATH). - def self.set(data_source_or_type, *args) - if data_source_or_type.kind_of?(DataSource) - @@instance = data_source_or_type - elsif data_source_or_type == :ruby - @@instance = RubyDataSource.new - elsif data_source_or_type == :zoneinfo - @@instance = ZoneinfoDataSource.new(*args) - else - raise ArgumentError, 'data_source_or_type must be a DataSource instance or a data source type (:ruby)' - end - end - - # Returns a TimezoneInfo instance for a given identifier. The TimezoneInfo - # instance should derive from either DataTimzoneInfo for timezones that - # define their own data or LinkedTimezoneInfo for links or aliases to - # other timezones. - # - # Raises InvalidTimezoneIdentifier if the timezone is not found or the - # identifier is invalid. - def load_timezone_info(identifier) - raise_invalid_data_source('load_timezone_info') - end - - # Returns an array of all the available timezone identifiers. - def timezone_identifiers - raise_invalid_data_source('timezone_identifiers') - end - - # Returns an array of all the available timezone identifiers for - # data timezones (i.e. those that actually contain definitions). - def data_timezone_identifiers - raise_invalid_data_source('data_timezone_identifiers') - end - - # Returns an array of all the available timezone identifiers that - # are links to other timezones. - def linked_timezone_identifiers - raise_invalid_data_source('linked_timezone_identifiers') - end - - # Returns a CountryInfo instance for the given ISO 3166-1 alpha-2 - # country code. Raises InvalidCountryCode if the country could not be found - # or the code is invalid. - def load_country_info(code) - raise_invalid_data_source('load_country_info') - end - - # Returns an array of all the available ISO 3166-1 alpha-2 - # country codes. - def country_codes - raise_invalid_data_source('country_codes') - end - - # Returns the name of this DataSource. - def to_s - "Default DataSource" - end - - # Returns internal object state as a programmer-readable string. - def inspect - "#<#{self.class}>" - end - - private - - # Creates a DataSource instance for use as the default. Used if - # no preference has been specified manually. - def self.create_default_data_source - has_tzinfo_data = false - - begin - require 'tzinfo/data' - has_tzinfo_data = true - rescue LoadError - end - - return RubyDataSource.new if has_tzinfo_data - - begin - return ZoneinfoDataSource.new - rescue ZoneinfoDirectoryNotFound - raise DataSourceNotFound, "No source of timezone data could be found.\nPlease refer to https://tzinfo.github.io/datasourcenotfound for help resolving this error." - end - end - - def raise_invalid_data_source(method_name) - raise InvalidDataSource, "#{method_name} not defined" - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/data_timezone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/data_timezone.rb deleted file mode 100644 index 94958c931c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/data_timezone.rb +++ /dev/null @@ -1,58 +0,0 @@ -module TZInfo - - # A Timezone based on a DataTimezoneInfo. - # - # @private - class DataTimezone < InfoTimezone #:nodoc: - - # Returns the TimezonePeriod for the given UTC time. utc can either be - # a DateTime, Time or integer timestamp (Time.to_i). Any timezone - # information in utc is ignored (it is treated as a UTC time). - # - # If no TimezonePeriod could be found, PeriodNotFound is raised. - def period_for_utc(utc) - info.period_for_utc(utc) - end - - # Returns the set of TimezonePeriod instances that are valid for the given - # local time as an array. If you just want a single period, use - # period_for_local instead and specify how abiguities should be resolved. - # Raises PeriodNotFound if no periods are found for the given time. - def periods_for_local(local) - info.periods_for_local(local) - end - - # Returns an Array of TimezoneTransition instances representing the times - # where the UTC offset of the timezone changes. - # - # Transitions are returned up to a given date and time up to a given date - # and time, specified in UTC (utc_to). - # - # A from date and time may also be supplied using the utc_from parameter - # (also specified in UTC). If utc_from is not nil, only transitions from - # that date and time onwards will be returned. - # - # Comparisons with utc_to are exclusive. Comparisons with utc_from are - # inclusive. If a transition falls precisely on utc_to, it will be excluded. - # If a transition falls on utc_from, it will be included. - # - # Transitions returned are ordered by when they occur, from earliest to - # latest. - # - # utc_to and utc_from can be specified using either DateTime, Time or - # integer timestamps (Time.to_i). - # - # If utc_from is specified and utc_to is not greater than utc_from, then - # transitions_up_to raises an ArgumentError exception. - def transitions_up_to(utc_to, utc_from = nil) - info.transitions_up_to(utc_to, utc_from) - end - - # Returns the canonical zone for this Timezone. - # - # For a DataTimezone, this is always self. - def canonical_zone - self - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/data_timezone_info.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/data_timezone_info.rb deleted file mode 100644 index 7d0fa5f371..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/data_timezone_info.rb +++ /dev/null @@ -1,55 +0,0 @@ -module TZInfo - # Represents a defined timezone containing transition data. - class DataTimezoneInfo < TimezoneInfo - - # Returns the TimezonePeriod for the given UTC time. - def period_for_utc(utc) - raise_not_implemented('period_for_utc') - end - - # Returns the set of TimezonePeriods for the given local time as an array. - # Results returned are ordered by increasing UTC start date. - # Returns an empty array if no periods are found for the given time. - def periods_for_local(local) - raise_not_implemented('periods_for_local') - end - - # Returns an Array of TimezoneTransition instances representing the times - # where the UTC offset of the timezone changes. - # - # Transitions are returned up to a given date and time up to a given date - # and time, specified in UTC (utc_to). - # - # A from date and time may also be supplied using the utc_from parameter - # (also specified in UTC). If utc_from is not nil, only transitions from - # that date and time onwards will be returned. - # - # Comparisons with utc_to are exclusive. Comparisons with utc_from are - # inclusive. If a transition falls precisely on utc_to, it will be excluded. - # If a transition falls on utc_from, it will be included. - # - # Transitions returned are ordered by when they occur, from earliest to - # latest. - # - # utc_to and utc_from can be specified using either DateTime, Time or - # integer timestamps (Time.to_i). - # - # If utc_from is specified and utc_to is not greater than utc_from, then - # transitions_up_to raises an ArgumentError exception. - def transitions_up_to(utc_to, utc_from = nil) - raise_not_implemented('transitions_up_to') - end - - # Constructs a Timezone instance for the timezone represented by this - # DataTimezoneInfo. - def create_timezone - DataTimezone.new(self) - end - - private - - def raise_not_implemented(method_name) - raise NotImplementedError, "Subclasses must override #{method_name}" - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/info_timezone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/info_timezone.rb deleted file mode 100644 index 4eb014be6a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/info_timezone.rb +++ /dev/null @@ -1,30 +0,0 @@ -module TZInfo - - # A Timezone based on a TimezoneInfo. - # - # @private - class InfoTimezone < Timezone #:nodoc: - - # Constructs a new InfoTimezone with a TimezoneInfo instance. - def self.new(info) - tz = super() - tz.send(:setup, info) - tz - end - - # The identifier of the timezone, e.g. "Europe/Paris". - def identifier - @info.identifier - end - - protected - # The TimezoneInfo for this Timezone. - def info - @info - end - - def setup(info) - @info = info - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/linked_timezone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/linked_timezone.rb deleted file mode 100644 index c4f4a0d4bb..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/linked_timezone.rb +++ /dev/null @@ -1,63 +0,0 @@ -module TZInfo - - # A Timezone based on a LinkedTimezoneInfo. - # - # @private - class LinkedTimezone < InfoTimezone #:nodoc: - # Returns the TimezonePeriod for the given UTC time. utc can either be - # a DateTime, Time or integer timestamp (Time.to_i). Any timezone - # information in utc is ignored (it is treated as a UTC time). - # - # If no TimezonePeriod could be found, PeriodNotFound is raised. - def period_for_utc(utc) - @linked_timezone.period_for_utc(utc) - end - - # Returns the set of TimezonePeriod instances that are valid for the given - # local time as an array. If you just want a single period, use - # period_for_local instead and specify how abiguities should be resolved. - # Raises PeriodNotFound if no periods are found for the given time. - def periods_for_local(local) - @linked_timezone.periods_for_local(local) - end - - # Returns an Array of TimezoneTransition instances representing the times - # where the UTC offset of the timezone changes. - # - # Transitions are returned up to a given date and time up to a given date - # and time, specified in UTC (utc_to). - # - # A from date and time may also be supplied using the utc_from parameter - # (also specified in UTC). If utc_from is not nil, only transitions from - # that date and time onwards will be returned. - # - # Comparisons with utc_to are exclusive. Comparisons with utc_from are - # inclusive. If a transition falls precisely on utc_to, it will be excluded. - # If a transition falls on utc_from, it will be included. - # - # Transitions returned are ordered by when they occur, from earliest to - # latest. - # - # utc_to and utc_from can be specified using either DateTime, Time or - # integer timestamps (Time.to_i). - # - # If utc_from is specified and utc_to is not greater than utc_from, then - # transitions_up_to raises an ArgumentError exception. - def transitions_up_to(utc_to, utc_from = nil) - @linked_timezone.transitions_up_to(utc_to, utc_from) - end - - # Returns the canonical zone for this Timezone. - # - # For a LinkedTimezone, this is the canonical zone of the link target. - def canonical_zone - @linked_timezone.canonical_zone - end - - protected - def setup(info) - super(info) - @linked_timezone = Timezone.get(info.link_to_identifier) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/linked_timezone_info.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/linked_timezone_info.rb deleted file mode 100644 index f7961d5596..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/linked_timezone_info.rb +++ /dev/null @@ -1,26 +0,0 @@ -module TZInfo - # Represents a timezone that is defined as a link or alias to another zone. - class LinkedTimezoneInfo < TimezoneInfo - - # The zone that provides the data (that this zone is an alias for). - attr_reader :link_to_identifier - - # Constructs a new LinkedTimezoneInfo with an identifier and the identifier - # of the zone linked to. - def initialize(identifier, link_to_identifier) - super(identifier) - @link_to_identifier = link_to_identifier - end - - # Returns internal object state as a programmer-readable string. - def inspect - "#<#{self.class}: #@identifier,#@link_to_identifier>" - end - - # Constructs a Timezone instance for the timezone represented by this - # DataTimezoneInfo. - def create_timezone - LinkedTimezone.new(self) - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/offset_rationals.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/offset_rationals.rb deleted file mode 100644 index 2a50a08767..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/offset_rationals.rb +++ /dev/null @@ -1,77 +0,0 @@ -require 'rational' unless defined?(Rational) - -module TZInfo - - # Provides a method for getting Rationals for a timezone offset in seconds. - # Pre-reduced rationals are returned for all the half-hour intervals between - # -14 and +14 hours to avoid having to call gcd at runtime. - # - # @private - module OffsetRationals #:nodoc: - @@rational_cache = { - -50400 => RubyCoreSupport.rational_new!(-7,12), - -48600 => RubyCoreSupport.rational_new!(-9,16), - -46800 => RubyCoreSupport.rational_new!(-13,24), - -45000 => RubyCoreSupport.rational_new!(-25,48), - -43200 => RubyCoreSupport.rational_new!(-1,2), - -41400 => RubyCoreSupport.rational_new!(-23,48), - -39600 => RubyCoreSupport.rational_new!(-11,24), - -37800 => RubyCoreSupport.rational_new!(-7,16), - -36000 => RubyCoreSupport.rational_new!(-5,12), - -34200 => RubyCoreSupport.rational_new!(-19,48), - -32400 => RubyCoreSupport.rational_new!(-3,8), - -30600 => RubyCoreSupport.rational_new!(-17,48), - -28800 => RubyCoreSupport.rational_new!(-1,3), - -27000 => RubyCoreSupport.rational_new!(-5,16), - -25200 => RubyCoreSupport.rational_new!(-7,24), - -23400 => RubyCoreSupport.rational_new!(-13,48), - -21600 => RubyCoreSupport.rational_new!(-1,4), - -19800 => RubyCoreSupport.rational_new!(-11,48), - -18000 => RubyCoreSupport.rational_new!(-5,24), - -16200 => RubyCoreSupport.rational_new!(-3,16), - -14400 => RubyCoreSupport.rational_new!(-1,6), - -12600 => RubyCoreSupport.rational_new!(-7,48), - -10800 => RubyCoreSupport.rational_new!(-1,8), - -9000 => RubyCoreSupport.rational_new!(-5,48), - -7200 => RubyCoreSupport.rational_new!(-1,12), - -5400 => RubyCoreSupport.rational_new!(-1,16), - -3600 => RubyCoreSupport.rational_new!(-1,24), - -1800 => RubyCoreSupport.rational_new!(-1,48), - 0 => RubyCoreSupport.rational_new!(0,1), - 1800 => RubyCoreSupport.rational_new!(1,48), - 3600 => RubyCoreSupport.rational_new!(1,24), - 5400 => RubyCoreSupport.rational_new!(1,16), - 7200 => RubyCoreSupport.rational_new!(1,12), - 9000 => RubyCoreSupport.rational_new!(5,48), - 10800 => RubyCoreSupport.rational_new!(1,8), - 12600 => RubyCoreSupport.rational_new!(7,48), - 14400 => RubyCoreSupport.rational_new!(1,6), - 16200 => RubyCoreSupport.rational_new!(3,16), - 18000 => RubyCoreSupport.rational_new!(5,24), - 19800 => RubyCoreSupport.rational_new!(11,48), - 21600 => RubyCoreSupport.rational_new!(1,4), - 23400 => RubyCoreSupport.rational_new!(13,48), - 25200 => RubyCoreSupport.rational_new!(7,24), - 27000 => RubyCoreSupport.rational_new!(5,16), - 28800 => RubyCoreSupport.rational_new!(1,3), - 30600 => RubyCoreSupport.rational_new!(17,48), - 32400 => RubyCoreSupport.rational_new!(3,8), - 34200 => RubyCoreSupport.rational_new!(19,48), - 36000 => RubyCoreSupport.rational_new!(5,12), - 37800 => RubyCoreSupport.rational_new!(7,16), - 39600 => RubyCoreSupport.rational_new!(11,24), - 41400 => RubyCoreSupport.rational_new!(23,48), - 43200 => RubyCoreSupport.rational_new!(1,2), - 45000 => RubyCoreSupport.rational_new!(25,48), - 46800 => RubyCoreSupport.rational_new!(13,24), - 48600 => RubyCoreSupport.rational_new!(9,16), - 50400 => RubyCoreSupport.rational_new!(7,12)}.freeze - - # Returns a Rational expressing the fraction of a day that offset in - # seconds represents (i.e. equivalent to Rational(offset, 86400)). - def rational_for_offset(offset) - @@rational_cache[offset] || Rational(offset, 86400) - end - module_function :rational_for_offset - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/posix_time_zone_parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/posix_time_zone_parser.rb deleted file mode 100644 index af2d7e0185..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/posix_time_zone_parser.rb +++ /dev/null @@ -1,136 +0,0 @@ -# encoding: UTF-8 -# frozen_string_literal: true - -require 'strscan' - -module TZInfo - # An {InvalidPosixTimeZone} exception is raised if an invalid POSIX-style - # time zone string is encountered. - # - # @private - class InvalidPosixTimeZone < StandardError #:nodoc: - end - - # A parser for POSIX-style TZ strings used in zoneinfo files and specified - # by tzfile.5 and tzset.3. - # - # @private - class PosixTimeZoneParser #:nodoc: - # Parses a POSIX-style TZ string, returning either a TimezoneOffset or - # an AnnualRules instance. - def parse(tz_string) - raise InvalidPosixTimeZone unless tz_string.kind_of?(String) - return nil if tz_string.empty? - - s = StringScanner.new(tz_string) - check_scan(s, /([^-+,\d<][^-+,\d]*) | <([^>]+)>/x) - std_abbrev = s[1] || s[2] - check_scan(s, /([-+]?\d+)(?::(\d+)(?::(\d+))?)?/) - std_offset = get_offset_from_hms(s[1], s[2], s[3]) - - if s.scan(/([^-+,\d<][^-+,\d]*) | <([^>]+)>/x) - dst_abbrev = s[1] || s[2] - - if s.scan(/([-+]?\d+)(?::(\d+)(?::(\d+))?)?/) - dst_offset = get_offset_from_hms(s[1], s[2], s[3]) - else - # POSIX is negative for ahead of UTC. - dst_offset = std_offset - 3600 - end - - dst_difference = std_offset - dst_offset - - start_rule = parse_rule(s, 'start') - end_rule = parse_rule(s, 'end') - - raise InvalidPosixTimeZone, "Expected the end of a POSIX-style time zone string but found '#{s.rest}'." if s.rest? - - if start_rule.is_always_first_day_of_year? && start_rule.transition_at == 0 && - end_rule.is_always_last_day_of_year? && end_rule.transition_at == 86400 + dst_difference - # Constant daylight savings time. - # POSIX is negative for ahead of UTC. - TimezoneOffset.new(-std_offset, dst_difference, dst_abbrev.to_sym) - else - AnnualRules.new( - TimezoneOffset.new(-std_offset, 0, std_abbrev.to_sym), - TimezoneOffset.new(-std_offset, dst_difference, dst_abbrev.to_sym), - start_rule, - end_rule) - end - elsif !s.rest? - # Constant standard time. - # POSIX is negative for ahead of UTC. - TimezoneOffset.new(-std_offset, 0, std_abbrev.to_sym) - else - raise InvalidPosixTimeZone, "Expected the end of a POSIX-style time zone string but found '#{s.rest}'." - end - end - - private - - # Parses the rule from the TZ string, returning a TransitionRule. - def parse_rule(s, type) - check_scan(s, /,(?: (?: J(\d+) ) | (\d+) | (?: M(\d+)\.(\d)\.(\d) ) )/x) - julian_day_of_year = s[1] - absolute_day_of_year = s[2] - month = s[3] - week = s[4] - day_of_week = s[5] - - if s.scan(/\//) - check_scan(s, /([-+]?\d+)(?::(\d+)(?::(\d+))?)?/) - transition_at = get_seconds_after_midnight_from_hms(s[1], s[2], s[3]) - else - transition_at = 7200 - end - - begin - if julian_day_of_year - JulianDayOfYearTransitionRule.new(julian_day_of_year.to_i, transition_at) - elsif absolute_day_of_year - AbsoluteDayOfYearTransitionRule.new(absolute_day_of_year.to_i, transition_at) - elsif week == '5' - LastDayOfMonthTransitionRule.new(month.to_i, day_of_week.to_i, transition_at) - else - DayOfMonthTransitionRule.new(month.to_i, week.to_i, day_of_week.to_i, transition_at) - end - rescue ArgumentError => e - raise InvalidPosixTimeZone, "Invalid #{type} rule in POSIX-style time zone string: #{e}" - end - end - - # Returns an offset in seconds from hh:mm:ss values. The value can be - # negative. -02:33:12 would represent 2 hours, 33 minutes and 12 seconds - # ahead of UTC. - def get_offset_from_hms(h, m, s) - h = h.to_i - m = m.to_i - s = s.to_i - raise InvalidPosixTimeZone, "Invalid minute #{m} in offset for POSIX-style time zone string." if m > 59 - raise InvalidPosixTimeZone, "Invalid second #{s} in offset for POSIX-style time zone string." if s > 59 - magnitude = (h.abs * 60 + m) * 60 + s - h < 0 ? -magnitude : magnitude - end - - # Returns the seconds from midnight from hh:mm:ss values. Hours can exceed - # 24 for a time on the following day. Hours can be negative to subtract - # hours from midnight on the given day. -02:33:12 represents 22:33:12 on - # the prior day. - def get_seconds_after_midnight_from_hms(h, m, s) - h = h.to_i - m = m.to_i - s = s.to_i - raise InvalidPosixTimeZone, "Invalid minute #{m} in time for POSIX-style time zone string." if m > 59 - raise InvalidPosixTimeZone, "Invalid second #{s} in time for POSIX-style time zone string." if s > 59 - (h * 3600) + m * 60 + s - end - - # Scans for a pattern and raises an exception if the pattern does not - # match the input. - def check_scan(s, pattern) - result = s.scan(pattern) - raise InvalidPosixTimeZone, "Expected '#{s.rest}' to match #{pattern} in POSIX-style time zone string." unless result - result - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/ruby_core_support.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/ruby_core_support.rb deleted file mode 100644 index 7ba776b39c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/ruby_core_support.rb +++ /dev/null @@ -1,169 +0,0 @@ -require 'date' -require 'rational' unless defined?(Rational) - -module TZInfo - - # Methods to support different versions of Ruby. - # - # @private - module RubyCoreSupport #:nodoc: - - # Use Rational.new! for performance reasons in Ruby 1.8. - # This has been removed from 1.9, but Rational performs better. - if Rational.respond_to? :new! - def self.rational_new!(numerator, denominator = 1) - Rational.new!(numerator, denominator) - end - else - def self.rational_new!(numerator, denominator = 1) - Rational(numerator, denominator) - end - end - - # Ruby 1.8.6 introduced new! and deprecated new0. - # Ruby 1.9.0 removed new0. - # Ruby trunk revision 31668 removed the new! method. - # Still support new0 for better performance on older versions of Ruby (new0 indicates - # that the rational has already been reduced to its lowest terms). - # Fallback to jd with conversion from ajd if new! and new0 are unavailable. - if DateTime.respond_to? :new! - def self.datetime_new!(ajd = 0, of = 0, sg = Date::ITALY) - DateTime.new!(ajd, of, sg) - end - elsif DateTime.respond_to? :new0 - def self.datetime_new!(ajd = 0, of = 0, sg = Date::ITALY) - DateTime.new0(ajd, of, sg) - end - else - HALF_DAYS_IN_DAY = rational_new!(1, 2) - - def self.datetime_new!(ajd = 0, of = 0, sg = Date::ITALY) - # Convert from an Astronomical Julian Day number to a civil Julian Day number. - jd = ajd + of + HALF_DAYS_IN_DAY - - # Ruby trunk revision 31862 changed the behaviour of DateTime.jd so that it will no - # longer accept a fractional civil Julian Day number if further arguments are specified. - # Calculate the hours, minutes and seconds to pass to jd. - - jd_i = jd.to_i - jd_i -= 1 if jd < 0 - hours = (jd - jd_i) * 24 - hours_i = hours.to_i - minutes = (hours - hours_i) * 60 - minutes_i = minutes.to_i - seconds = (minutes - minutes_i) * 60 - - DateTime.jd(jd_i, hours_i, minutes_i, seconds, of, sg) - end - end - - # DateTime in Ruby 1.8.6 doesn't consider times within the 60th second to be - # valid. When attempting to specify such a DateTime, subtract the fractional - # part and then add it back later - if Date.respond_to?(:valid_time?) && !Date.valid_time?(0, 0, rational_new!(59001, 1000)) # 0:0:59.001 - def self.datetime_new(y=-4712, m=1, d=1, h=0, min=0, s=0, of=0, sg=Date::ITALY) - if !s.kind_of?(Integer) && s > 59 - dt = DateTime.new(y, m, d, h, min, 59, of, sg) - dt + (s - 59) / 86400 - else - DateTime.new(y, m, d, h, min, s, of, sg) - end - end - else - def self.datetime_new(y=-4712, m=1, d=1, h=0, min=0, s=0, of=0, sg=Date::ITALY) - DateTime.new(y, m, d, h, min, s, of, sg) - end - end - - # Returns true if Time on the runtime platform supports Times defined - # by negative 32-bit timestamps, otherwise false. - begin - Time.at(-1) - Time.at(-2147483648) - - def self.time_supports_negative - true - end - rescue ArgumentError - def self.time_supports_negative - false - end - end - - # Returns true if Time on the runtime platform supports Times defined by - # 64-bit timestamps, otherwise false. - begin - Time.at(-2147483649) - Time.at(2147483648) - - def self.time_supports_64bit - true - end - rescue RangeError - def self.time_supports_64bit - false - end - end - - # Return the result of Time#nsec if it exists, otherwise return the - # result of Time#usec * 1000. - if Time.method_defined?(:nsec) - def self.time_nsec(time) - time.nsec - end - else - def self.time_nsec(time) - time.usec * 1000 - end - end - - # Call String#force_encoding if this version of Ruby has encoding support - # otherwise treat as a no-op. - if String.method_defined?(:force_encoding) - def self.force_encoding(str, encoding) - str.force_encoding(encoding) - end - else - def self.force_encoding(str, encoding) - str - end - end - - - # Wrapper for File.open that supports passing hash options for specifying - # encodings on Ruby 1.9+. The options are ignored on earlier versions of - # Ruby. - if RUBY_VERSION =~ /\A1\.[0-8]\./ - def self.open_file(file_name, mode, opts, &block) - File.open(file_name, mode, &block) - end - elsif RUBY_VERSION =~ /\A1\.9\./ - def self.open_file(file_name, mode, opts, &block) - File.open(file_name, mode, opts, &block) - end - else - # Evaluate method as a string because **opts isn't valid syntax prior to - # Ruby 2.0. - eval(<<-EOF - def self.open_file(file_name, mode, opts, &block) - File.open(file_name, mode, **opts, &block) - end - EOF - ) - end - - - # Object#untaint is a deprecated no-op in Ruby >= 2.7 and will be removed in - # 3.2. Add a refinement to either silence the warning, or supply the method - # if needed. - if !Object.new.respond_to?(:untaint) || RUBY_VERSION =~ /\A(\d+)\.(\d+)(?:\.|\z)/ && ($1 == '2' && $2.to_i >= 7 || $1.to_i >= 3) - module UntaintExt - refine Object do - def untaint - self - end - end - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/ruby_country_info.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/ruby_country_info.rb deleted file mode 100644 index e51915d628..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/ruby_country_info.rb +++ /dev/null @@ -1,74 +0,0 @@ -module TZInfo - # Represents information about a country returned by RubyDataSource. - # - # @private - class RubyCountryInfo < CountryInfo #:nodoc: - # Constructs a new CountryInfo with an ISO 3166 country code, name and - # block. The block will be evaluated to obtain the timezones for the - # country when the zones are first needed. - def initialize(code, name, &block) - super(code, name) - @block = block - @zones = nil - @zone_identifiers = nil - end - - # Returns a frozen array of all the zone identifiers for the country. These - # are in the order they were added using the timezone method. - def zone_identifiers - # Thread-safety: It is possible that the value of @zone_identifiers may be - # calculated multiple times in concurrently executing threads. It is not - # worth the overhead of locking to ensure that @zone_identifiers is only - # calculated once. - - unless @zone_identifiers - result = zones.collect {|zone| zone.identifier}.freeze - return result if frozen? - @zone_identifiers = result - end - - @zone_identifiers - end - - # Returns a frozen array of all the timezones for the for the country as - # CountryTimezone instances. These are in the order they were added using - # the timezone method. - def zones - # Thread-safety: It is possible that the value of @zones may be - # calculated multiple times in concurrently executing threads. It is not - # worth the overhead of locking to ensure that @zones is only - # calculated once. - - unless @zones - zones = Zones.new - @block.call(zones) if @block - result = zones.list.freeze - return result if frozen? - @block = nil - @zones = result - end - - @zones - end - - # An instance of the Zones class is passed to the block used to define - # timezones. - # - # @private - class Zones #:nodoc: - attr_reader :list - - def initialize - @list = [] - end - - # Called by the index data to define a timezone for the country. - def timezone(identifier, latitude_numerator, latitude_denominator, - longitude_numerator, longitude_denominator, description = nil) - @list << CountryTimezone.new!(identifier, latitude_numerator, - latitude_denominator, longitude_numerator, longitude_denominator, - description) - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/ruby_data_source.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/ruby_data_source.rb deleted file mode 100644 index b5a67524f4..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/ruby_data_source.rb +++ /dev/null @@ -1,140 +0,0 @@ -module TZInfo - # Use send as a workaround for erroneous 'wrong number of arguments' errors - # with JRuby 9.0.5.0 when calling methods with Java implementations. See #114. - send(:using, RubyCoreSupport::UntaintExt) if RubyCoreSupport.const_defined?(:UntaintExt) - - # A DataSource that loads data from the set of Ruby modules included in the - # TZInfo::Data library (tzinfo-data gem). - # - # To have TZInfo use this DataSource, call TZInfo::DataSource.set as follows: - # - # TZInfo::DataSource.set(:ruby) - class RubyDataSource < DataSource - # Whether the timezone index has been loaded yet. - @@timezone_index_loaded = false - - # Whether the country index has been loaded yet. - @@country_index_loaded = false - - # Initializes a new RubyDataSource instance. - def initialize - tzinfo_data = File.join('tzinfo', 'data') - begin - require(tzinfo_data) - - data_file = File.join('', 'tzinfo', 'data.rb') - path = $".reverse_each.detect {|p| p.end_with?(data_file) } - if path - @base_path = File.join(File.dirname(path), 'data').untaint - else - @base_path = tzinfo_data - end - rescue LoadError - @base_path = tzinfo_data - end - end - - # Returns a TimezoneInfo instance for a given identifier. - # Raises InvalidTimezoneIdentifier if the timezone is not found or the - # identifier is invalid. - def load_timezone_info(identifier) - raise InvalidTimezoneIdentifier, 'Invalid identifier' if identifier !~ /^[A-Za-z0-9\+\-_]+(\/[A-Za-z0-9\+\-_]+)*$/ - - identifier = identifier.gsub(/-/, '__m__').gsub(/\+/, '__p__') - - # Untaint identifier after it has been reassigned to a new string. We - # don't want to modify the original identifier. identifier may also be - # frozen and therefore cannot be untainted. - identifier.untaint - - identifier = identifier.split('/') - begin - require_definition(identifier) - - m = Data::Definitions - identifier.each {|part| - m = m.const_get(part) - } - - m.get - rescue LoadError, NameError => e - raise InvalidTimezoneIdentifier, e.message - end - end - - # Returns an array of all the available timezone identifiers. - def timezone_identifiers - load_timezone_index - Data::Indexes::Timezones.timezones - end - - # Returns an array of all the available timezone identifiers for - # data timezones (i.e. those that actually contain definitions). - def data_timezone_identifiers - load_timezone_index - Data::Indexes::Timezones.data_timezones - end - - # Returns an array of all the available timezone identifiers that - # are links to other timezones. - def linked_timezone_identifiers - load_timezone_index - Data::Indexes::Timezones.linked_timezones - end - - # Returns a CountryInfo instance for the given ISO 3166-1 alpha-2 - # country code. Raises InvalidCountryCode if the country could not be found - # or the code is invalid. - def load_country_info(code) - load_country_index - info = Data::Indexes::Countries.countries[code] - raise InvalidCountryCode, 'Invalid country code' unless info - info - end - - # Returns an array of all the available ISO 3166-1 alpha-2 - # country codes. - def country_codes - load_country_index - Data::Indexes::Countries.countries.keys.freeze - end - - # Returns the name of this DataSource. - def to_s - "Ruby DataSource" - end - - private - - # Requires a zone definition by its identifier (split on /). - def require_definition(identifier) - require_data(*(['definitions'] + identifier)) - end - - # Requires an index by its name. - def require_index(name) - require_data(*['indexes', name]) - end - - # Requires a file from tzinfo/data. - def require_data(*file) - require(File.join(@base_path, *file)) - end - - # Loads in the index of timezones if it hasn't already been loaded. - def load_timezone_index - unless @@timezone_index_loaded - require_index('timezones') - @@timezone_index_loaded = true - end - end - - # Loads in the index of countries if it hasn't already been loaded. - def load_country_index - unless @@country_index_loaded - require_index('countries') - @@country_index_loaded = true - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/time_or_datetime.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/time_or_datetime.rb deleted file mode 100644 index 56c33147bb..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/time_or_datetime.rb +++ /dev/null @@ -1,351 +0,0 @@ -require 'date' -require 'rational' unless defined?(Rational) -require 'time' - -module TZInfo - # Used by TZInfo internally to represent either a Time, DateTime or - # an Integer timestamp (seconds since 1970-01-01 00:00:00). - class TimeOrDateTime - include Comparable - - # Constructs a new TimeOrDateTime. timeOrDateTime can be a Time, DateTime - # or Integer. If using a Time or DateTime, any time zone information - # is ignored. - # - # Integer timestamps must be within the range supported by Time on the - # platform being used. - def initialize(timeOrDateTime) - @time = nil - @datetime = nil - @timestamp = nil - - if timeOrDateTime.is_a?(Time) - @time = timeOrDateTime - - # Avoid using the slower Rational class unless necessary. - nsec = RubyCoreSupport.time_nsec(@time) - usec = nsec % 1000 == 0 ? nsec / 1000 : Rational(nsec, 1000) - - @time = Time.utc(@time.year, @time.mon, @time.mday, @time.hour, @time.min, @time.sec, usec) unless @time.utc? - @orig = @time - elsif timeOrDateTime.is_a?(DateTime) - @datetime = timeOrDateTime - @datetime = @datetime.new_offset(0) unless @datetime.offset == 0 - @orig = @datetime - else - @timestamp = timeOrDateTime.to_i - - if !RubyCoreSupport.time_supports_64bit && (@timestamp > 2147483647 || @timestamp < -2147483648 || (@timestamp < 0 && !RubyCoreSupport.time_supports_negative)) - raise RangeError, 'Timestamp is outside the supported range of Time on this platform' - end - - @orig = @timestamp - end - end - - # Returns the time as a Time. - # - # When converting from a DateTime, the result is truncated to microsecond - # precision. - def to_time - # Thread-safety: It is possible that the value of @time may be - # calculated multiple times in concurrently executing threads. It is not - # worth the overhead of locking to ensure that @time is only - # calculated once. - - unless @time - result = if @timestamp - Time.at(@timestamp).utc - else - Time.utc(year, mon, mday, hour, min, sec, usec) - end - - return result if frozen? - @time = result - end - - @time - end - - # Returns the time as a DateTime. - # - # When converting from a Time, the result is truncated to microsecond - # precision. - def to_datetime - # Thread-safety: It is possible that the value of @datetime may be - # calculated multiple times in concurrently executing threads. It is not - # worth the overhead of locking to ensure that @datetime is only - # calculated once. - - unless @datetime - # Avoid using Rational unless necessary. - u = usec - s = u == 0 ? sec : Rational(sec * 1000000 + u, 1000000) - result = RubyCoreSupport.datetime_new(year, mon, mday, hour, min, s) - return result if frozen? - @datetime = result - end - - @datetime - end - - # Returns the time as an integer timestamp. - def to_i - # Thread-safety: It is possible that the value of @timestamp may be - # calculated multiple times in concurrently executing threads. It is not - # worth the overhead of locking to ensure that @timestamp is only - # calculated once. - - unless @timestamp - result = to_time.to_i - return result if frozen? - @timestamp = result - end - - @timestamp - end - - # Returns the time as the original time passed to new. - def to_orig - @orig - end - - # Returns a string representation of the TimeOrDateTime. - def to_s - if @orig.is_a?(Time) - "Time: #{@orig.to_s}" - elsif @orig.is_a?(DateTime) - "DateTime: #{@orig.to_s}" - else - "Timestamp: #{@orig.to_s}" - end - end - - # Returns internal object state as a programmer-readable string. - def inspect - "#<#{self.class}: #{@orig.inspect}>" - end - - # Returns the year. - def year - if @time - @time.year - elsif @datetime - @datetime.year - else - to_time.year - end - end - - # Returns the month of the year (1..12). - def mon - if @time - @time.mon - elsif @datetime - @datetime.mon - else - to_time.mon - end - end - alias :month :mon - - # Returns the day of the month (1..n). - def mday - if @time - @time.mday - elsif @datetime - @datetime.mday - else - to_time.mday - end - end - alias :day :mday - - # Returns the day of the week (0..6 for Sunday to Saturday). - def wday - if @time - @time.wday - elsif @datetime - @datetime.wday - else - to_time.wday - end - end - - # Returns the hour of the day (0..23). - def hour - if @time - @time.hour - elsif @datetime - @datetime.hour - else - to_time.hour - end - end - - # Returns the minute of the hour (0..59). - def min - if @time - @time.min - elsif @datetime - @datetime.min - else - to_time.min - end - end - - # Returns the second of the minute (0..60). (60 for a leap second). - def sec - if @time - @time.sec - elsif @datetime - @datetime.sec - else - to_time.sec - end - end - - # Returns the number of microseconds for the time. - def usec - if @time - @time.usec - elsif @datetime - # Ruby 1.8 has sec_fraction (of which the documentation says - # 'I do NOT recommend you to use this method'). sec_fraction no longer - # exists in Ruby 1.9. - - # Calculate the sec_fraction from the day_fraction. - ((@datetime.day_fraction - OffsetRationals.rational_for_offset(@datetime.hour * 3600 + @datetime.min * 60 + @datetime.sec)) * 86400000000).to_i - else - 0 - end - end - - # Compares this TimeOrDateTime with another Time, DateTime, timestamp - # (Integer) or TimeOrDateTime. Returns -1, 0 or +1 depending - # whether the receiver is less than, equal to, or greater than - # timeOrDateTime. - # - # Returns nil if the passed in timeOrDateTime is not comparable with - # TimeOrDateTime instances. - # - # Comparisons involving a DateTime will be performed using DateTime#<=>. - # Comparisons that don't involve a DateTime, but include a Time will be - # performed with Time#<=>. Otherwise comparisons will be performed with - # Integer#<=>. - def <=>(timeOrDateTime) - return nil unless timeOrDateTime.is_a?(TimeOrDateTime) || - timeOrDateTime.is_a?(Time) || - timeOrDateTime.is_a?(DateTime) || - timeOrDateTime.respond_to?(:to_i) - - unless timeOrDateTime.is_a?(TimeOrDateTime) - timeOrDateTime = TimeOrDateTime.wrap(timeOrDateTime) - end - - orig = timeOrDateTime.to_orig - - if @orig.is_a?(DateTime) || orig.is_a?(DateTime) - # If either is a DateTime, assume it is there for a reason - # (i.e. for its larger range of acceptable values on 32-bit systems). - to_datetime <=> timeOrDateTime.to_datetime - elsif @orig.is_a?(Time) || orig.is_a?(Time) - to_time <=> timeOrDateTime.to_time - else - to_i <=> timeOrDateTime.to_i - end - end - - # Adds a number of seconds to the TimeOrDateTime. Returns a new - # TimeOrDateTime, preserving what the original constructed type was. - # If the original type is a Time and the resulting calculation goes out of - # range for Times, then an exception will be raised by the Time class. - def +(seconds) - if seconds == 0 - self - else - if @orig.is_a?(DateTime) - TimeOrDateTime.new(@orig + OffsetRationals.rational_for_offset(seconds)) - else - # + defined for Time and Integer - TimeOrDateTime.new(@orig + seconds) - end - end - end - - # Subtracts a number of seconds from the TimeOrDateTime. Returns a new - # TimeOrDateTime, preserving what the original constructed type was. - # If the original type is a Time and the resulting calculation goes out of - # range for Times, then an exception will be raised by the Time class. - def -(seconds) - self + (-seconds) - end - - # Similar to the + operator, but converts to a DateTime based TimeOrDateTime - # where the Time or Integer timestamp to go out of the allowed range for a - # Time, converts to a DateTime based TimeOrDateTime. - # - # Note that the range of Time varies based on the platform. - def add_with_convert(seconds) - if seconds == 0 - self - else - if @orig.is_a?(DateTime) - TimeOrDateTime.new(@orig + OffsetRationals.rational_for_offset(seconds)) - else - # A Time or timestamp. - result = to_i + seconds - - if ((result > 2147483647 || result < -2147483648) && !RubyCoreSupport.time_supports_64bit) || (result < 0 && !RubyCoreSupport.time_supports_negative) - result = TimeOrDateTime.new(to_datetime + OffsetRationals.rational_for_offset(seconds)) - else - result = TimeOrDateTime.new(@orig + seconds) - end - end - end - end - - # Returns true if todt represents the same time and was originally - # constructed with the same type (DateTime, Time or timestamp) as this - # TimeOrDateTime. - def eql?(todt) - todt.kind_of?(TimeOrDateTime) && to_orig.eql?(todt.to_orig) - end - - # Returns a hash of this TimeOrDateTime. - def hash - @orig.hash - end - - # If no block is given, returns a TimeOrDateTime wrapping the given - # timeOrDateTime. If a block is specified, a TimeOrDateTime is constructed - # and passed to the block. The result of the block must be a TimeOrDateTime. - # - # The result of the block will be converted to the type of the originally - # passed in timeOrDateTime and then returned as the result of wrap. - # - # timeOrDateTime can be a Time, DateTime, timestamp (Integer) or - # TimeOrDateTime. If a TimeOrDateTime is passed in, no new TimeOrDateTime - # will be constructed and the value passed to wrap will be used when - # calling the block. - def self.wrap(timeOrDateTime) - t = timeOrDateTime.is_a?(TimeOrDateTime) ? timeOrDateTime : TimeOrDateTime.new(timeOrDateTime) - - if block_given? - t = yield t - - if timeOrDateTime.is_a?(TimeOrDateTime) - t - elsif timeOrDateTime.is_a?(Time) - t.to_time - elsif timeOrDateTime.is_a?(DateTime) - t.to_datetime - else - t.to_i - end - else - t - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone.rb deleted file mode 100644 index ee838b975a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone.rb +++ /dev/null @@ -1,673 +0,0 @@ -require 'date' -require 'set' -require 'thread_safe' - -module TZInfo - # AmbiguousTime is raised to indicates that a specified time in a local - # timezone has more than one possible equivalent UTC time. This happens when - # transitioning from daylight savings time to standard time where the clocks - # are rolled back. - # - # AmbiguousTime is raised by period_for_local and local_to_utc when using an - # ambiguous time and not specifying any means to resolve the ambiguity. - class AmbiguousTime < StandardError - end - - # PeriodNotFound is raised to indicate that no TimezonePeriod matching a given - # time could be found. - class PeriodNotFound < StandardError - end - - # Raised by Timezone#get if the identifier given is not valid. - class InvalidTimezoneIdentifier < StandardError - end - - # Raised if an attempt is made to use a timezone created with - # Timezone.new(nil). - class UnknownTimezone < StandardError - end - - # Timezone is the base class of all timezones. It provides a factory method, - # 'get', to access timezones by identifier. Once a specific Timezone has been - # retrieved, DateTimes, Times and timestamps can be converted between the UTC - # and the local time for the zone. For example: - # - # tz = TZInfo::Timezone.get('America/New_York') - # puts tz.utc_to_local(DateTime.new(2005,8,29,15,35,0)).to_s - # puts tz.local_to_utc(Time.utc(2005,8,29,11,35,0)).to_s - # puts tz.utc_to_local(1125315300).to_s - # - # Each time conversion method returns an object of the same type it was - # passed. - # - # The Timezone class is thread-safe. It is safe to use class and instance - # methods of Timezone in concurrently executing threads. Instances of Timezone - # can be shared across thread boundaries. - class Timezone - include Comparable - - # Cache of loaded zones by identifier to avoid using require if a zone - # has already been loaded. - # - # @!visibility private - @@loaded_zones = nil - - # Default value of the dst parameter of the local_to_utc and - # period_for_local methods. - # - # @!visibility private - @@default_dst = nil - - # Sets the default value of the optional dst parameter of the - # local_to_utc and period_for_local methods. Can be set to nil, true or - # false. - # - # The value of default_dst defaults to nil if unset. - def self.default_dst=(value) - @@default_dst = value.nil? ? nil : !!value - end - - # Gets the default value of the optional dst parameter of the - # local_to_utc and period_for_local methods. Can be set to nil, true or - # false. - def self.default_dst - @@default_dst - end - - # Returns a timezone by its identifier (e.g. "Europe/London", - # "America/Chicago" or "UTC"). - # - # Raises InvalidTimezoneIdentifier if the timezone couldn't be found. - def self.get(identifier) - instance = @@loaded_zones[identifier] - - unless instance - # Thread-safety: It is possible that multiple equivalent Timezone - # instances could be created here in concurrently executing threads. - # The consequences of this are that the data may be loaded more than - # once (depending on the data source) and memoized calculations could - # be discarded. The performance benefit of ensuring that only a single - # instance is created is unlikely to be worth the overhead of only - # allowing one Timezone to be loaded at a time. - info = data_source.load_timezone_info(identifier) - instance = info.create_timezone - @@loaded_zones[instance.identifier] = instance - end - - instance - end - - # Returns a proxy for the Timezone with the given identifier. The proxy - # will cause the real timezone to be loaded when an attempt is made to - # find a period or convert a time. get_proxy will not validate the - # identifier. If an invalid identifier is specified, no exception will be - # raised until the proxy is used. - def self.get_proxy(identifier) - TimezoneProxy.new(identifier) - end - - # If identifier is nil calls super(), otherwise calls get. An identfier - # should always be passed in when called externally. - def self.new(identifier = nil) - if identifier - get(identifier) - else - super() - end - end - - # Returns an array containing all the available Timezones. - # - # Returns TimezoneProxy objects to avoid the overhead of loading Timezone - # definitions until a conversion is actually required. - def self.all - get_proxies(all_identifiers) - end - - # Returns an array containing the identifiers of all the available - # Timezones. - def self.all_identifiers - data_source.timezone_identifiers - end - - # Returns an array containing all the available Timezones that are based - # on data (are not links to other Timezones). - # - # Returns TimezoneProxy objects to avoid the overhead of loading Timezone - # definitions until a conversion is actually required. - def self.all_data_zones - get_proxies(all_data_zone_identifiers) - end - - # Returns an array containing the identifiers of all the available - # Timezones that are based on data (are not links to other Timezones).. - def self.all_data_zone_identifiers - data_source.data_timezone_identifiers - end - - # Returns an array containing all the available Timezones that are links - # to other Timezones. - # - # Returns TimezoneProxy objects to avoid the overhead of loading Timezone - # definitions until a conversion is actually required. - def self.all_linked_zones - get_proxies(all_linked_zone_identifiers) - end - - # Returns an array containing the identifiers of all the available - # Timezones that are links to other Timezones. - def self.all_linked_zone_identifiers - data_source.linked_timezone_identifiers - end - - # Returns all the Timezones defined for all Countries. This is not the - # complete set of Timezones as some are not country specific (e.g. - # 'Etc/GMT'). - # - # Returns TimezoneProxy objects to avoid the overhead of loading Timezone - # definitions until a conversion is actually required. - def self.all_country_zones - Country.all_codes.inject([]) do |zones,country| - zones += Country.get(country).zones - end.uniq - end - - # Returns all the zone identifiers defined for all Countries. This is not the - # complete set of zone identifiers as some are not country specific (e.g. - # 'Etc/GMT'). You can obtain a Timezone instance for a given identifier - # with the get method. - def self.all_country_zone_identifiers - Country.all_codes.inject([]) do |zones,country| - zones += Country.get(country).zone_identifiers - end.uniq - end - - # Returns all US Timezone instances. A shortcut for - # TZInfo::Country.get('US').zones. - # - # Returns TimezoneProxy objects to avoid the overhead of loading Timezone - # definitions until a conversion is actually required. - def self.us_zones - Country.get('US').zones - end - - # Returns all US zone identifiers. A shortcut for - # TZInfo::Country.get('US').zone_identifiers. - def self.us_zone_identifiers - Country.get('US').zone_identifiers - end - - # The identifier of the timezone, e.g. "Europe/Paris". - def identifier - raise_unknown_timezone - end - - # An alias for identifier. - def name - # Don't use alias, as identifier gets overridden. - identifier - end - - # Returns a friendlier version of the identifier. - def to_s - friendly_identifier - end - - # Returns internal object state as a programmer-readable string. - def inspect - "#<#{self.class}: #{identifier}>" - end - - # Returns a friendlier version of the identifier. Set skip_first_part to - # omit the first part of the identifier (typically a region name) where - # there is more than one part. - # - # For example: - # - # Timezone.get('Europe/Paris').friendly_identifier(false) #=> "Europe - Paris" - # Timezone.get('Europe/Paris').friendly_identifier(true) #=> "Paris" - # Timezone.get('America/Indiana/Knox').friendly_identifier(false) #=> "America - Knox, Indiana" - # Timezone.get('America/Indiana/Knox').friendly_identifier(true) #=> "Knox, Indiana" - def friendly_identifier(skip_first_part = false) - parts = identifier.split('/') - if parts.empty? - # shouldn't happen - identifier - elsif parts.length == 1 - parts[0] - else - prefix = skip_first_part ? nil : "#{parts[0]} - " - - parts = parts.drop(1).map do |part| - part.gsub!(/_/, ' ') - - if part.index(/[a-z]/) - # Missing a space if a lower case followed by an upper case and the - # name isn't McXxxx. - part.gsub!(/([^M][a-z])([A-Z])/, '\1 \2') - part.gsub!(/([M][a-bd-z])([A-Z])/, '\1 \2') - - # Missing an apostrophe if two consecutive upper case characters. - part.gsub!(/([A-Z])([A-Z])/, '\1\'\2') - end - - part - end - - "#{prefix}#{parts.reverse.join(', ')}" - end - end - - # Returns the TimezonePeriod for the given UTC time. utc can either be - # a DateTime, Time or integer timestamp (Time.to_i). Any timezone - # information in utc is ignored (it is treated as a UTC time). - def period_for_utc(utc) - raise_unknown_timezone - end - - # Returns the set of TimezonePeriod instances that are valid for the given - # local time as an array. If you just want a single period, use - # period_for_local instead and specify how ambiguities should be resolved. - # Returns an empty array if no periods are found for the given time. - def periods_for_local(local) - raise_unknown_timezone - end - - # Returns an Array of TimezoneTransition instances representing the times - # where the UTC offset of the timezone changes. - # - # Transitions are returned up to a given date and time up to a given date - # and time, specified in UTC (utc_to). - # - # A from date and time may also be supplied using the utc_from parameter - # (also specified in UTC). If utc_from is not nil, only transitions from - # that date and time onwards will be returned. - # - # Comparisons with utc_to are exclusive. Comparisons with utc_from are - # inclusive. If a transition falls precisely on utc_to, it will be excluded. - # If a transition falls on utc_from, it will be included. - # - # Transitions returned are ordered by when they occur, from earliest to - # latest. - # - # utc_to and utc_from can be specified using either DateTime, Time or - # integer timestamps (Time.to_i). - # - # If utc_from is specified and utc_to is not greater than utc_from, then - # transitions_up_to raises an ArgumentError exception. - def transitions_up_to(utc_to, utc_from = nil) - raise_unknown_timezone - end - - # Returns the canonical Timezone instance for this Timezone. - # - # The IANA Time Zone database contains two types of definition: Zones and - # Links. Zones are defined by rules that set out when transitions occur. - # Links are just references to fully defined Zone, creating an alias for - # that Zone. - # - # Links are commonly used where a time zone has been renamed in a - # release of the Time Zone database. For example, the Zone US/Eastern was - # renamed as America/New_York. A US/Eastern Link was added in its place, - # linking to (and creating an alias for) for America/New_York. - # - # Links are also used for time zones that are currently identical to a full - # Zone, but that are administered seperately. For example, Europe/Vatican is - # a Link to (and alias for) Europe/Rome. - # - # For a full Zone, canonical_zone returns self. - # - # For a Link, canonical_zone returns a Timezone instance representing the - # full Zone that the link targets. - # - # TZInfo can be used with different data sources (see the documentation for - # TZInfo::DataSource). Please note that some DataSource implementations may - # not support distinguishing between full Zones and Links and will treat all - # time zones as full Zones. In this case, the canonical_zone will always - # return self. - # - # There are two built-in DataSource implementations. RubyDataSource (which - # will be used if the tzinfo-data gem is available) supports Link zones. - # ZoneinfoDataSource returns Link zones as if they were full Zones. If the - # canonical_zone or canonical_identifier methods are required, the - # tzinfo-data gem should be installed. - # - # The TZInfo::DataSource.get method can be used to check which DataSource - # implementation is being used. - def canonical_zone - raise_unknown_timezone - end - - # Returns the TimezonePeriod for the given local time. local can either be - # a DateTime, Time or integer timestamp (Time.to_i). Any timezone - # information in local is ignored (it is treated as a time in the current - # timezone). - # - # Warning: There are local times that have no equivalent UTC times (e.g. - # in the transition from standard time to daylight savings time). There are - # also local times that have more than one UTC equivalent (e.g. in the - # transition from daylight savings time to standard time). - # - # In the first case (no equivalent UTC time), a PeriodNotFound exception - # will be raised. - # - # In the second case (more than one equivalent UTC time), an AmbiguousTime - # exception will be raised unless the optional dst parameter or block - # handles the ambiguity. - # - # If the ambiguity is due to a transition from daylight savings time to - # standard time, the dst parameter can be used to select whether the - # daylight savings time or local time is used. For example, - # - # Timezone.get('America/New_York').period_for_local(DateTime.new(2004,10,31,1,30,0)) - # - # would raise an AmbiguousTime exception. - # - # Specifying dst=true would the daylight savings period from April to - # October 2004. Specifying dst=false would return the standard period - # from October 2004 to April 2005. - # - # If the dst parameter does not resolve the ambiguity, and a block is - # specified, it is called. The block must take a single parameter - an - # array of the periods that need to be resolved. The block can select and - # return a single period or return nil or an empty array - # to cause an AmbiguousTime exception to be raised. - # - # The default value of the dst parameter can be specified by setting - # Timezone.default_dst. If default_dst is not set, or is set to nil, then - # an AmbiguousTime exception will be raised in ambiguous situations unless - # a block is given to resolve the ambiguity. - def period_for_local(local, dst = Timezone.default_dst) - results = periods_for_local(local) - - if results.empty? - raise PeriodNotFound - elsif results.size < 2 - results.first - else - # ambiguous result try to resolve - - if !dst.nil? - matches = results.find_all {|period| period.dst? == dst} - results = matches if !matches.empty? - end - - if results.size < 2 - results.first - else - # still ambiguous, try the block - - if block_given? - results = yield results - end - - if results.is_a?(TimezonePeriod) - results - elsif results && results.size == 1 - results.first - else - raise AmbiguousTime, "#{local} is an ambiguous local time." - end - end - end - end - - # Converts a time in UTC to the local timezone. utc can either be - # a DateTime, Time or timestamp (Time.to_i). The returned time has the same - # type as utc. Any timezone information in utc is ignored (it is treated as - # a UTC time). - def utc_to_local(utc) - TimeOrDateTime.wrap(utc) {|wrapped| - period_for_utc(wrapped).to_local(wrapped) - } - end - - # Converts a time in the local timezone to UTC. local can either be - # a DateTime, Time or timestamp (Time.to_i). The returned time has the same - # type as local. Any timezone information in local is ignored (it is treated - # as a local time). - # - # Warning: There are local times that have no equivalent UTC times (e.g. - # in the transition from standard time to daylight savings time). There are - # also local times that have more than one UTC equivalent (e.g. in the - # transition from daylight savings time to standard time). - # - # In the first case (no equivalent UTC time), a PeriodNotFound exception - # will be raised. - # - # In the second case (more than one equivalent UTC time), an AmbiguousTime - # exception will be raised unless the optional dst parameter or block - # handles the ambiguity. - # - # If the ambiguity is due to a transition from daylight savings time to - # standard time, the dst parameter can be used to select whether the - # daylight savings time or local time is used. For example, - # - # Timezone.get('America/New_York').local_to_utc(DateTime.new(2004,10,31,1,30,0)) - # - # would raise an AmbiguousTime exception. - # - # Specifying dst=true would return 2004-10-31 5:30:00. Specifying dst=false - # would return 2004-10-31 6:30:00. - # - # If the dst parameter does not resolve the ambiguity, and a block is - # specified, it is called. The block must take a single parameter - an - # array of the periods that need to be resolved. The block can return a - # single period to use to convert the time or return nil or an empty array - # to cause an AmbiguousTime exception to be raised. - # - # The default value of the dst parameter can be specified by setting - # Timezone.default_dst. If default_dst is not set, or is set to nil, then - # an AmbiguousTime exception will be raised in ambiguous situations unless - # a block is given to resolve the ambiguity. - def local_to_utc(local, dst = Timezone.default_dst) - TimeOrDateTime.wrap(local) {|wrapped| - if block_given? - period = period_for_local(wrapped, dst) {|periods| yield periods } - else - period = period_for_local(wrapped, dst) - end - - period.to_utc(wrapped) - } - end - - # Returns information about offsets used by the Timezone up to a given - # date and time, specified using UTC (utc_to). The information is returned - # as an Array of TimezoneOffset instances. - # - # A from date and time may also be supplied using the utc_from parameter - # (also specified in UTC). If utc_from is not nil, only offsets used from - # that date and time forward will be returned. - # - # Comparisons with utc_to are exclusive. Comparisons with utc_from are - # inclusive. - # - # Offsets may be returned in any order. - # - # utc_to and utc_from can be specified using either DateTime, Time or - # integer timestamps (Time.to_i). - # - # If utc_from is specified and utc_to is not greater than utc_from, then - # offsets_up_to raises an ArgumentError exception. - def offsets_up_to(utc_to, utc_from = nil) - utc_to = TimeOrDateTime.wrap(utc_to) - transitions = transitions_up_to(utc_to, utc_from) - - if transitions.empty? - # No transitions in the range, find the period that covers it. - - if utc_from - # Use the from date as it is inclusive. - period = period_for_utc(utc_from) - else - # utc_to is exclusive, so this can't be used with period_for_utc. - # However, any time earlier than utc_to can be used. - - # Subtract 1 hour (since this is one of the cached OffsetRationals). - # Use add_with_convert so that conversion to DateTime is performed if - # required. - period = period_for_utc(utc_to.add_with_convert(-3600)) - end - - [period.offset] - else - result = Set.new - - first = transitions.first - result << first.previous_offset unless utc_from && first.at == utc_from - - transitions.each do |t| - result << t.offset - end - - result.to_a - end - end - - # Returns the canonical identifier for this Timezone. - # - # This is a shortcut for calling canonical_zone.identifier. Please refer - # to the canonical_zone documentation for further information. - def canonical_identifier - canonical_zone.identifier - end - - # Returns the current time in the timezone as a Time. - def now - utc_to_local(Time.now.utc) - end - - # Returns the TimezonePeriod for the current time. - def current_period - period_for_utc(Time.now.utc) - end - - # Returns the current Time and TimezonePeriod as an array. The first element - # is the time, the second element is the period. - def current_period_and_time - utc = Time.now.utc - period = period_for_utc(utc) - [period.to_local(utc), period] - end - - alias :current_time_and_period :current_period_and_time - - # Converts a time in UTC to local time and returns it as a string according - # to the given format. - # - # The formatting is identical to Time.strftime and DateTime.strftime, except - # %Z and %z are replaced with the timezone abbreviation (for example, EST or - # EDT) and offset for the specified Timezone and time. - # - # The offset can be formatted as follows: - # - # - %z - hour and minute (e.g. +0500) - # - %:z - hour and minute separated with a colon (e.g. +05:00) - # - %::z - hour minute and second separated with colons (e.g. +05:00:00) - # - %:::z - hour only (e.g. +05) - # - # Timezone#strftime currently handles the replacement of %z. From TZInfo - # version 2.0.0, %z will be passed to Time#strftime and DateTime#strftime - # instead. Some of the formatting options may cease to be available - # depending on the version of Ruby in use (for example, %:::z is only - # supported by Time#strftime from MRI version 2.0.0 onwards). - def strftime(format, utc = Time.now.utc) - utc = TimeOrDateTime.wrap(utc) - period = period_for_utc(utc) - local_wrapped = period.to_local(utc) - local = local_wrapped.to_orig - local = local_wrapped.to_time unless local.kind_of?(Time) || local.kind_of?(DateTime) - abbreviation = period.abbreviation.to_s.gsub(/%/, '%%') - - format = format.gsub(/%(%*)([sZ]|:*z)/) do - if $1.length.odd? - # Escaped literal percent or series of percents. Pass on to strftime. - "#$1%#$2" - elsif $2 == "s" - "#$1#{utc.to_i}" - elsif $2 == "Z" - "#$1#{abbreviation}" - else - m, s = period.utc_total_offset.divmod(60) - h, m = m.divmod(60) - case $2.length - when 1 - "#$1#{'%+03d%02d' % [h,m]}" - when 2 - "#$1#{'%+03d:%02d' % [h,m]}" - when 3 - "#$1#{'%+03d:%02d:%02d' % [h,m,s]}" - when 4 - "#$1#{'%+03d' % [h]}" - else # more than 3 colons - not a valid option - # Passing the invalid format string through to Time#strftime or - # DateTime#strtime would normally result in it being returned in the - # result. However, with Ruby 1.8.7 on Windows (as tested with Ruby - # 1.8.7-p374 from https://rubyinstaller.org/downloads/archives), - # this causes Time#strftime to always return an empty string (e.g. - # Time.now.strftime('a %::::z b') returns ''). - # - # Escape the percent to force it to be evaluated as a literal. - "#$1%%#$2" - end - end - end - - local.strftime(format) - end - - # Compares two Timezones based on their identifier. Returns -1 if tz is less - # than self, 0 if tz is equal to self and +1 if tz is greater than self. - # - # Returns nil if tz is not comparable with Timezone instances. - def <=>(tz) - return nil unless tz.is_a?(Timezone) - identifier <=> tz.identifier - end - - # Returns true if and only if the identifier of tz is equal to the - # identifier of this Timezone. - def eql?(tz) - self == tz - end - - # Returns a hash of this Timezone. - def hash - identifier.hash - end - - # Dumps this Timezone for marshalling. - def _dump(limit) - identifier - end - - # Loads a marshalled Timezone. - def self._load(data) - Timezone.get(data) - end - - private - # Initializes @@loaded_zones. - def self.init_loaded_zones - @@loaded_zones = ThreadSafe::Cache.new - end - init_loaded_zones - - # Returns an array of proxies corresponding to the given array of - # identifiers. - def self.get_proxies(identifiers) - identifiers.collect {|identifier| get_proxy(identifier)} - end - - # Returns the current DataSource. - def self.data_source - DataSource.get - end - - # Raises an UnknownTimezone exception. - def raise_unknown_timezone - raise UnknownTimezone, 'TZInfo::Timezone constructed directly' - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_definition.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_definition.rb deleted file mode 100644 index 5ceb686e44..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_definition.rb +++ /dev/null @@ -1,36 +0,0 @@ -module TZInfo - - # TimezoneDefinition is included into Timezone definition modules. - # TimezoneDefinition provides the methods for defining timezones. - # - # @private - module TimezoneDefinition #:nodoc: - # Add class methods to the includee. - def self.append_features(base) - super - base.extend(ClassMethods) - end - - # Class methods for inclusion. - # - # @private - module ClassMethods #:nodoc: - # Returns and yields a TransitionDataTimezoneInfo object to define a - # timezone. - def timezone(identifier) - yield @timezone = TransitionDataTimezoneInfo.new(identifier) - end - - # Defines a linked timezone. - def linked_timezone(identifier, link_to_identifier) - @timezone = LinkedTimezoneInfo.new(identifier, link_to_identifier) - end - - # Returns the last TimezoneInfo to be defined with timezone or - # linked_timezone. - def get - @timezone - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_index_definition.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_index_definition.rb deleted file mode 100644 index 59dc9530c5..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_index_definition.rb +++ /dev/null @@ -1,54 +0,0 @@ -module TZInfo - # The timezone index file includes TimezoneIndexDefinition which provides - # methods used to define timezones in the index. - # - # @private - module TimezoneIndexDefinition #:nodoc: - # Add class methods to the includee and initialize class instance variables. - def self.append_features(base) - super - base.extend(ClassMethods) - base.instance_eval do - @timezones = [] - @data_timezones = [] - @linked_timezones = [] - end - end - - # Class methods for inclusion. - # - # @private - module ClassMethods #:nodoc: - # Defines a timezone based on data. - def timezone(identifier) - @timezones << identifier - @data_timezones << identifier - end - - # Defines a timezone which is a link to another timezone. - def linked_timezone(identifier) - @timezones << identifier - @linked_timezones << identifier - end - - # Returns a frozen array containing the identifiers of all the timezones. - # Identifiers appear in the order they were defined in the index. - def timezones - @timezones.freeze - end - - # Returns a frozen array containing the identifiers of all data timezones. - # Identifiers appear in the order they were defined in the index. - def data_timezones - @data_timezones.freeze - end - - # Returns a frozen array containing the identifiers of all linked - # timezones. Identifiers appear in the order they were defined in - # the index. - def linked_timezones - @linked_timezones.freeze - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_info.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_info.rb deleted file mode 100644 index 13f66bad5c..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_info.rb +++ /dev/null @@ -1,30 +0,0 @@ -module TZInfo - # Represents a timezone defined by a data source. - class TimezoneInfo - - # The timezone identifier. - attr_reader :identifier - - # Constructs a new TimezoneInfo with an identifier. - def initialize(identifier) - @identifier = identifier - end - - # Returns internal object state as a programmer-readable string. - def inspect - "#<#{self.class}: #@identifier>" - end - - # Constructs a Timezone instance for the timezone represented by this - # TimezoneInfo. - def create_timezone - raise_not_implemented('create_timezone') - end - - private - - def raise_not_implemented(method_name) - raise NotImplementedError, "Subclasses must override #{method_name}" - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_offset.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_offset.rb deleted file mode 100644 index dbce0e92f4..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_offset.rb +++ /dev/null @@ -1,101 +0,0 @@ -module TZInfo - # Represents an offset defined in a Timezone data file. - class TimezoneOffset - # The base offset of the timezone from UTC in seconds. This does not include - # any adjustment made for daylight savings time and will typically remain - # constant throughout the year. - # - # To obtain the currently observed offset from UTC, including the effect of - # daylight savings time, use utc_total_offset instead. - # - # Note that zoneinfo files only include the value of utc_total_offset and a - # DST flag. When using ZoneinfoDataSource, the utc_offset will be derived - # from changes to the UTC total offset and the DST flag. As a consequence, - # utc_total_offset will always be correct, but utc_offset may be inaccurate. - # - # If you require utc_offset to be accurate, install the tzinfo-data gem and - # set RubyDataSource as the DataSource. - attr_reader :utc_offset - - # The offset from the time zone's standard time in seconds. Zero - # when daylight savings time is not in effect. Non-zero (usually 3600 = 1 - # hour) if daylight savings is being observed. - # - # Note that zoneinfo files only include the value of utc_total_offset and - # a DST flag. When using DataSources::ZoneinfoDataSource, the std_offset - # will be derived from changes to the UTC total offset and the DST flag. As - # a consequence, utc_total_offset will always be correct, but std_offset - # may be inaccurate. - # - # If you require std_offset to be accurate, install the tzinfo-data gem - # and set RubyDataSource as the DataSource. - attr_reader :std_offset - - # The total offset of this observance from UTC in seconds - # (utc_offset + std_offset). - attr_reader :utc_total_offset - - # The abbreviation that identifies this observance, e.g. "GMT" - # (Greenwich Mean Time) or "BST" (British Summer Time) for "Europe/London". The returned identifier is a - # symbol. - attr_reader :abbreviation - - # Constructs a new TimezoneOffset. utc_offset and std_offset are specified - # in seconds. - def initialize(utc_offset, std_offset, abbreviation) - @utc_offset = utc_offset - @std_offset = std_offset - @abbreviation = abbreviation - - @utc_total_offset = @utc_offset + @std_offset - end - - # True if std_offset is non-zero. - def dst? - @std_offset != 0 - end - - # Converts a UTC Time, DateTime or integer timestamp to local time, based on - # the offset of this period. - # - # Deprecation warning: this method will be removed in TZInfo version 2.0.0. - def to_local(utc) - TimeOrDateTime.wrap(utc) {|wrapped| - wrapped + @utc_total_offset - } - end - - # Converts a local Time, DateTime or integer timestamp to UTC, based on the - # offset of this period. - # - # Deprecation warning: this method will be removed in TZInfo version 2.0.0. - def to_utc(local) - TimeOrDateTime.wrap(local) {|wrapped| - wrapped - @utc_total_offset - } - end - - # Returns true if and only if toi has the same utc_offset, std_offset - # and abbreviation as this TimezoneOffset. - def ==(toi) - toi.kind_of?(TimezoneOffset) && - utc_offset == toi.utc_offset && std_offset == toi.std_offset && abbreviation == toi.abbreviation - end - - # Returns true if and only if toi has the same utc_offset, std_offset - # and abbreviation as this TimezoneOffset. - def eql?(toi) - self == toi - end - - # Returns a hash of this TimezoneOffset. - def hash - utc_offset.hash ^ std_offset.hash ^ abbreviation.hash - end - - # Returns internal object state as a programmer-readable string. - def inspect - "#<#{self.class}: #@utc_offset,#@std_offset,#@abbreviation>" - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_period.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_period.rb deleted file mode 100644 index 28058412ec..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_period.rb +++ /dev/null @@ -1,245 +0,0 @@ -module TZInfo - # A period of time in a timezone where the same offset from UTC applies. - # - # All the methods that take times accept instances of Time or DateTime as well - # as Integer timestamps. - class TimezonePeriod - # The TimezoneTransition that defines the start of this TimezonePeriod - # (may be nil if unbounded). - attr_reader :start_transition - - # The TimezoneTransition that defines the end of this TimezonePeriod - # (may be nil if unbounded). - attr_reader :end_transition - - # The TimezoneOffset for this period. - attr_reader :offset - - # Initializes a new TimezonePeriod. - # - # TimezonePeriod instances should not normally be constructed manually. - def initialize(start_transition, end_transition, offset = nil) - @start_transition = start_transition - @end_transition = end_transition - - if offset - raise ArgumentError, 'Offset specified with transitions' if @start_transition || @end_transition - @offset = offset - else - if @start_transition - @offset = @start_transition.offset - elsif @end_transition - @offset = @end_transition.previous_offset - else - raise ArgumentError, 'No offset specified and no transitions to determine it from' - end - end - - @utc_total_offset_rational = nil - end - - # The base offset of the timezone from UTC in seconds. This does not include - # any adjustment made for daylight savings time and will typically remain - # constant throughout the year. - # - # To obtain the currently observed offset from UTC, including the effect of - # daylight savings time, use utc_total_offset instead. - # - # Note that zoneinfo files only include the value of utc_total_offset and a - # DST flag. When using ZoneinfoDataSource, the utc_offset will be derived - # from changes to the UTC total offset and the DST flag. As a consequence, - # utc_total_offset will always be correct, but utc_offset may be inaccurate. - # - # If you require utc_offset to be accurate, install the tzinfo-data gem and - # set RubyDataSource as the DataSource. - def utc_offset - @offset.utc_offset - end - - # The offset from the time zone's standard time in seconds. Zero - # when daylight savings time is not in effect. Non-zero (usually 3600 = 1 - # hour) if daylight savings is being observed. - # - # Note that zoneinfo files only include the value of utc_total_offset and - # a DST flag. When using DataSources::ZoneinfoDataSource, the std_offset - # will be derived from changes to the UTC total offset and the DST flag. As - # a consequence, utc_total_offset will always be correct, but std_offset - # may be inaccurate. - # - # If you require std_offset to be accurate, install the tzinfo-data gem - # and set RubyDataSource as the DataSource. - def std_offset - @offset.std_offset - end - - # The identifier of this period, e.g. "GMT" (Greenwich Mean Time) or "BST" - # (British Summer Time) for "Europe/London". The returned identifier is a - # symbol. - def abbreviation - @offset.abbreviation - end - alias :zone_identifier :abbreviation - - # Total offset from UTC (seconds). Equal to utc_offset + std_offset. - def utc_total_offset - @offset.utc_total_offset - end - - # Total offset from UTC (days). Result is a Rational. - def utc_total_offset_rational - # Thread-safety: It is possible that the value of - # @utc_total_offset_rational may be calculated multiple times in - # concurrently executing threads. It is not worth the overhead of locking - # to ensure that @zone_identifiers is only calculated once. - - unless @utc_total_offset_rational - result = OffsetRationals.rational_for_offset(utc_total_offset) - return result if frozen? - @utc_total_offset_rational = result - end - @utc_total_offset_rational - end - - # The start time of the period in UTC as a DateTime. May be nil if unbounded. - def utc_start - @start_transition ? @start_transition.at.to_datetime : nil - end - - # The start time of the period in UTC as a Time. May be nil if unbounded. - def utc_start_time - @start_transition ? @start_transition.at.to_time : nil - end - - # The end time of the period in UTC as a DateTime. May be nil if unbounded. - def utc_end - @end_transition ? @end_transition.at.to_datetime : nil - end - - # The end time of the period in UTC as a Time. May be nil if unbounded. - def utc_end_time - @end_transition ? @end_transition.at.to_time : nil - end - - # The start time of the period in local time as a DateTime. May be nil if - # unbounded. - def local_start - @start_transition ? @start_transition.local_start_at.to_datetime : nil - end - - # The start time of the period in local time as a Time. May be nil if - # unbounded. - def local_start_time - @start_transition ? @start_transition.local_start_at.to_time : nil - end - - # The end time of the period in local time as a DateTime. May be nil if - # unbounded. - def local_end - @end_transition ? @end_transition.local_end_at.to_datetime : nil - end - - # The end time of the period in local time as a Time. May be nil if - # unbounded. - def local_end_time - @end_transition ? @end_transition.local_end_at.to_time : nil - end - - # true if daylight savings is in effect for this period; otherwise false. - def dst? - @offset.dst? - end - - # true if this period is valid for the given UTC DateTime; otherwise false. - # - # Deprecation warning: this method will be removed in TZInfo version 2.0.0. - def valid_for_utc?(utc) - utc_after_start?(utc) && utc_before_end?(utc) - end - - # true if the given UTC DateTime is after the start of the period - # (inclusive); otherwise false. - # - # Deprecation warning: this method will be removed in TZInfo version 2.0.0. - def utc_after_start?(utc) - !@start_transition || @start_transition.at <= utc - end - - # true if the given UTC DateTime is before the end of the period - # (exclusive); otherwise false. - # - # Deprecation warning: this method will be removed in TZInfo version 2.0.0. - def utc_before_end?(utc) - !@end_transition || @end_transition.at > utc - end - - # true if this period is valid for the given local DateTime; otherwise - # false. - # - # Deprecation warning: this method will be removed in TZInfo version 2.0.0. - def valid_for_local?(local) - local_after_start?(local) && local_before_end?(local) - end - - # true if the given local DateTime is after the start of the period - # (inclusive); otherwise false. - # - # Deprecation warning: this method will be removed in TZInfo version 2.0.0. - def local_after_start?(local) - !@start_transition || @start_transition.local_start_at <= local - end - - # true if the given local DateTime is before the end of the period - # (exclusive); otherwise false. - # - # Deprecation warning: this method will be removed in TZInfo version 2.0.0. - def local_before_end?(local) - !@end_transition || @end_transition.local_end_at > local - end - - # Converts a UTC DateTime to local time based on the offset of this period. - # - # Deprecation warning: this method will be removed in TZInfo version 2.0.0. - def to_local(utc) - @offset.to_local(utc) - end - - # Converts a local DateTime to UTC based on the offset of this period. - # - # Deprecation warning: this method will be removed in TZInfo version 2.0.0. - def to_utc(local) - @offset.to_utc(local) - end - - # Returns true if this TimezonePeriod is equal to p. This compares the - # start_transition, end_transition and offset using ==. - def ==(p) - p.kind_of?(TimezonePeriod) && - start_transition == p.start_transition && - end_transition == p.end_transition && - offset == p.offset - end - - # Returns true if this TimezonePeriods is equal to p. This compares the - # start_transition, end_transition and offset using eql? - def eql?(p) - p.kind_of?(TimezonePeriod) && - start_transition.eql?(p.start_transition) && - end_transition.eql?(p.end_transition) && - offset.eql?(p.offset) - end - - # Returns a hash of this TimezonePeriod. - def hash - result = @start_transition.hash ^ @end_transition.hash - result ^= @offset.hash unless @start_transition || @end_transition - result - end - - # Returns internal object state as a programmer-readable string. - def inspect - result = "#<#{self.class}: #{@start_transition.inspect},#{@end_transition.inspect}" - result << ",#{@offset.inspect}>" unless @start_transition || @end_transition - result + '>' - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_proxy.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_proxy.rb deleted file mode 100644 index c913011cea..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_proxy.rb +++ /dev/null @@ -1,105 +0,0 @@ -module TZInfo - - # A proxy class representing a timezone with a given identifier. TimezoneProxy - # inherits from Timezone and can be treated like any Timezone loaded with - # Timezone.get. - # - # The first time an attempt is made to access the data for the timezone, the - # real Timezone is loaded. If the proxy's identifier was not valid, then an - # exception will be raised at this point. - class TimezoneProxy < Timezone - # Construct a new TimezoneProxy for the given identifier. The identifier - # is not checked when constructing the proxy. It will be validated on the - # when the real Timezone is loaded. - def self.new(identifier) - # Need to override new to undo the behaviour introduced in Timezone#new. - tzp = super() - tzp.send(:setup, identifier) - tzp - end - - # The identifier of the timezone, e.g. "Europe/Paris". - def identifier - @real_timezone ? @real_timezone.identifier : @identifier - end - - # Returns the TimezonePeriod for the given UTC time. utc can either be - # a DateTime, Time or integer timestamp (Time.to_i). Any timezone - # information in utc is ignored (it is treated as a UTC time). - def period_for_utc(utc) - real_timezone.period_for_utc(utc) - end - - # Returns the set of TimezonePeriod instances that are valid for the given - # local time as an array. If you just want a single period, use - # period_for_local instead and specify how abiguities should be resolved. - # Returns an empty array if no periods are found for the given time. - def periods_for_local(local) - real_timezone.periods_for_local(local) - end - - # Returns an Array of TimezoneTransition instances representing the times - # where the UTC offset of the timezone changes. - # - # Transitions are returned up to a given date and time up to a given date - # and time (to). - # - # A from date and time may also be supplied using the from parameter. If - # from is not nil, only transitions from that date and time onwards will be - # returned. - # - # Comparisons with to are exclusive. Comparisons with from are inclusive. - # If a transition falls precisely on to, it will be excluded. If a - # transition falls on from, it will be included. - # - # Transitions returned are ordered by when they occur, from earliest to - # latest. - # - # to and from can be specified using either a Time, DateTime, Time or - # Timestamp. - # - # If from is specified and to is not greater than from, then an - # ArgumentError exception is raised. - # - # ArgumentError is raised if to is nil or of either to or from are - # Timestamps with unspecified offsets. - def transitions_up_to(to, from = nil) - real_timezone.transitions_up_to(to, from) - end - - # Returns the canonical zone for this Timezone. - def canonical_zone - real_timezone.canonical_zone - end - - # Dumps this TimezoneProxy for marshalling. - def _dump(limit) - identifier - end - - # Loads a marshalled TimezoneProxy. - def self._load(data) - TimezoneProxy.new(data) - end - - private - def setup(identifier) - @identifier = identifier - @real_timezone = nil - end - - def real_timezone - # Thread-safety: It is possible that the value of @real_timezone may be - # calculated multiple times in concurrently executing threads. It is not - # worth the overhead of locking to ensure that @real_timezone is only - # calculated once. - unless @real_timezone - result = Timezone.get(@identifier) - return result if frozen? - @real_timezone = result - end - - @real_timezone - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_transition.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_transition.rb deleted file mode 100644 index b905c627ae..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_transition.rb +++ /dev/null @@ -1,130 +0,0 @@ -module TZInfo - # Represents a transition from one timezone offset to another at a particular - # date and time. - class TimezoneTransition - # The offset this transition changes to (a TimezoneOffset instance). - attr_reader :offset - - # The offset this transition changes from (a TimezoneOffset instance). - attr_reader :previous_offset - - # Initializes a new TimezoneTransition. - # - # TimezoneTransition instances should not normally be constructed manually. - def initialize(offset, previous_offset) - @offset = offset - @previous_offset = previous_offset - @local_end_at = nil - @local_start_at = nil - end - - # A TimeOrDateTime instance representing the UTC time when this transition - # occurs. - def at - raise_not_implemented('at') - end - - # The UTC time when this transition occurs, returned as a DateTime instance. - def datetime - at.to_datetime - end - - # The UTC time when this transition occurs, returned as a Time instance. - def time - at.to_time - end - - # A TimeOrDateTime instance representing the local time when this transition - # causes the previous observance to end (calculated from at using - # previous_offset). - def local_end_at - # Thread-safety: It is possible that the value of @local_end_at may be - # calculated multiple times in concurrently executing threads. It is not - # worth the overhead of locking to ensure that @local_end_at is only - # calculated once. - - unless @local_end_at - result = at.add_with_convert(@previous_offset.utc_total_offset) - return result if frozen? - @local_end_at = result - end - - @local_end_at - end - - # The local time when this transition causes the previous observance to end, - # returned as a DateTime instance. - def local_end - local_end_at.to_datetime - end - - # The local time when this transition causes the previous observance to end, - # returned as a Time instance. - def local_end_time - local_end_at.to_time - end - - # A TimeOrDateTime instance representing the local time when this transition - # causes the next observance to start (calculated from at using offset). - def local_start_at - # Thread-safety: It is possible that the value of @local_start_at may be - # calculated multiple times in concurrently executing threads. It is not - # worth the overhead of locking to ensure that @local_start_at is only - # calculated once. - - unless @local_start_at - result = at.add_with_convert(@offset.utc_total_offset) - return result if frozen? - @local_start_at = result - end - - @local_start_at - end - - # The local time when this transition causes the next observance to start, - # returned as a DateTime instance. - def local_start - local_start_at.to_datetime - end - - # The local time when this transition causes the next observance to start, - # returned as a Time instance. - def local_start_time - local_start_at.to_time - end - - # Returns true if this TimezoneTransition is equal to the given - # TimezoneTransition. Two TimezoneTransition instances are - # considered to be equal by == if offset, previous_offset and at are all - # equal. - def ==(tti) - tti.kind_of?(TimezoneTransition) && - offset == tti.offset && previous_offset == tti.previous_offset && at == tti.at - end - - # Returns true if this TimezoneTransition is equal to the given - # TimezoneTransition. Two TimezoneTransition instances are - # considered to be equal by eql? if offset, previous_offset and at are all - # equal and the type used to define at in both instances is the same. - def eql?(tti) - tti.kind_of?(TimezoneTransition) && - offset == tti.offset && previous_offset == tti.previous_offset && at.eql?(tti.at) - end - - # Returns a hash of this TimezoneTransition instance. - def hash - @offset.hash ^ @previous_offset.hash ^ at.hash - end - - # Returns internal object state as a programmer-readable string. - def inspect - "#<#{self.class}: #{at.inspect},#{@offset.inspect}>" - end - - private - - def raise_not_implemented(method_name) - raise NotImplementedError, "Subclasses must override #{method_name}" - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_transition_definition.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_transition_definition.rb deleted file mode 100644 index 016816b850..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/timezone_transition_definition.rb +++ /dev/null @@ -1,104 +0,0 @@ -module TZInfo - # A TimezoneTransition defined by as integer timestamp, as a rational to - # create a DateTime or as both. - # - # @private - class TimezoneTransitionDefinition < TimezoneTransition #:nodoc: - # The numerator of the DateTime if the transition time is defined as a - # DateTime, otherwise the transition time as a timestamp. - attr_reader :numerator_or_time - protected :numerator_or_time - - # Either the denominator of the DateTime if the transition time is defined - # as a DateTime, otherwise nil. - attr_reader :denominator - protected :denominator - - # Creates a new TimezoneTransitionDefinition with the given offset, - # previous_offset (both TimezoneOffset instances) and UTC time. - # - # The time can be specified as a timestamp, as a rational to create a - # DateTime, or as both. - # - # If both a timestamp and rational are given, then the rational will only - # be used if the timestamp falls outside of the range of Time on the - # platform being used at runtime. - # - # DateTimes are created from the rational as follows: - # - # RubyCoreSupport.datetime_new!(RubyCoreSupport.rational_new!(numerator, denominator), 0, Date::ITALY) - # - # For performance reasons, the numerator and denominator must be specified - # in their lowest form. - def initialize(offset, previous_offset, numerator_or_timestamp, denominator_or_numerator = nil, denominator = nil) - super(offset, previous_offset) - - if denominator - numerator = denominator_or_numerator - timestamp = numerator_or_timestamp - elsif denominator_or_numerator - numerator = numerator_or_timestamp - denominator = denominator_or_numerator - timestamp = nil - else - numerator = nil - denominator = nil - timestamp = numerator_or_timestamp - end - - # Determine whether to use the timestamp or the numerator and denominator. - if numerator && ( - !timestamp || - (timestamp < 0 && !RubyCoreSupport.time_supports_negative) || - ((timestamp < -2147483648 || timestamp > 2147483647) && !RubyCoreSupport.time_supports_64bit) - ) - - @numerator_or_time = numerator - @denominator = denominator - else - @numerator_or_time = timestamp - @denominator = nil - end - - @at = nil - end - - # A TimeOrDateTime instance representing the UTC time when this transition - # occurs. - def at - # Thread-safety: It is possible that the value of @at may be calculated - # multiple times in concurrently executing threads. It is not worth the - # overhead of locking to ensure that @at is only calculated once. - - unless @at - result = unless @denominator - TimeOrDateTime.new(@numerator_or_time) - else - r = RubyCoreSupport.rational_new!(@numerator_or_time, @denominator) - dt = RubyCoreSupport.datetime_new!(r, 0, Date::ITALY) - TimeOrDateTime.new(dt) - end - - return result if frozen? - @at = result - end - - @at - end - - # Returns true if this TimezoneTransitionDefinition is equal to the given - # TimezoneTransitionDefinition. Two TimezoneTransitionDefinition instances - # are considered to be equal by eql? if offset, previous_offset, - # numerator_or_time and denominator are all equal. - def eql?(tti) - tti.kind_of?(TimezoneTransitionDefinition) && - offset == tti.offset && previous_offset == tti.previous_offset && - numerator_or_time == tti.numerator_or_time && denominator == tti.denominator - end - - # Returns a hash of this TimezoneTransitionDefinition instance. - def hash - @offset.hash ^ @previous_offset.hash ^ @numerator_or_time.hash ^ @denominator.hash - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/transition_data_timezone_info.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/transition_data_timezone_info.rb deleted file mode 100644 index 026bf227a7..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/transition_data_timezone_info.rb +++ /dev/null @@ -1,274 +0,0 @@ -module TZInfo - # Raised if no offsets have been defined when calling period_for_utc or - # periods_for_local. Indicates an error in the timezone data. - class NoOffsetsDefined < StandardError - end - - # Represents a data timezone defined by a set of offsets and a set - # of transitions. - # - # @private - class TransitionDataTimezoneInfo < DataTimezoneInfo #:nodoc: - - # Constructs a new TransitionDataTimezoneInfo with its identifier. - def initialize(identifier) - super(identifier) - @offsets = {} - @transitions = [] - @previous_offset = nil - @transitions_index = nil - end - - # Defines a offset. The id uniquely identifies this offset within the - # timezone. utc_offset and std_offset define the offset in seconds of - # standard time from UTC and daylight savings from standard time - # respectively. abbreviation describes the timezone offset (e.g. GMT, BST, - # EST or EDT). - # - # The first offset to be defined is treated as the offset that applies - # until the first transition. This will usually be in Local Mean Time (LMT). - # - # ArgumentError will be raised if the id is already defined. - def offset(id, utc_offset, std_offset, abbreviation) - raise ArgumentError, 'Offset already defined' if @offsets.has_key?(id) - - offset = TimezoneOffset.new(utc_offset, std_offset, abbreviation) - @offsets[id] = offset - @previous_offset = offset unless @previous_offset - end - - # Defines a transition. Transitions must be defined in chronological order. - # ArgumentError will be raised if a transition is added out of order. - # offset_id refers to an id defined with offset. ArgumentError will be - # raised if the offset_id cannot be found. numerator_or_time and - # denomiator specify the time the transition occurs as. See - # TimezoneTransition for more detail about specifying times. - def transition(year, month, offset_id, numerator_or_timestamp, denominator_or_numerator = nil, denominator = nil) - offset = @offsets[offset_id] - raise ArgumentError, 'Offset not found' unless offset - - if @transitions_index - if year < @last_year || (year == @last_year && month < @last_month) - raise ArgumentError, 'Transitions must be increasing date order' - end - - # Record the position of the first transition with this index. - index = transition_index(year, month) - @transitions_index[index] ||= @transitions.length - - # Fill in any gaps - (index - 1).downto(0) do |i| - break if @transitions_index[i] - @transitions_index[i] = @transitions.length - end - else - @transitions_index = [@transitions.length] - @start_year = year - @start_month = month - end - - @transitions << TimezoneTransitionDefinition.new(offset, @previous_offset, - numerator_or_timestamp, denominator_or_numerator, denominator) - @last_year = year - @last_month = month - @previous_offset = offset - end - - # Returns the TimezonePeriod for the given UTC time. - # Raises NoOffsetsDefined if no offsets have been defined. - def period_for_utc(utc) - unless @transitions.empty? - utc = TimeOrDateTime.wrap(utc) - index = transition_index(utc.year, utc.mon) - - start_transition = nil - start = transition_before_end(index) - if start - start.downto(0) do |i| - if @transitions[i].at <= utc - start_transition = @transitions[i] - break - end - end - end - - end_transition = nil - start = transition_after_start(index) - if start - start.upto(@transitions.length - 1) do |i| - if @transitions[i].at > utc - end_transition = @transitions[i] - break - end - end - end - - if start_transition || end_transition - TimezonePeriod.new(start_transition, end_transition) - else - # Won't happen since there are transitions. Must always find one - # transition that is either >= or < the specified time. - raise 'No transitions found in search' - end - else - raise NoOffsetsDefined, 'No offsets have been defined' unless @previous_offset - TimezonePeriod.new(nil, nil, @previous_offset) - end - end - - # Returns the set of TimezonePeriods for the given local time as an array. - # Results returned are ordered by increasing UTC start date. - # Returns an empty array if no periods are found for the given time. - # Raises NoOffsetsDefined if no offsets have been defined. - def periods_for_local(local) - unless @transitions.empty? - local = TimeOrDateTime.wrap(local) - index = transition_index(local.year, local.mon) - - result = [] - - start_index = transition_after_start(index - 1) - if start_index && @transitions[start_index].local_end_at > local - if start_index > 0 - if @transitions[start_index - 1].local_start_at <= local - result << TimezonePeriod.new(@transitions[start_index - 1], @transitions[start_index]) - end - else - result << TimezonePeriod.new(nil, @transitions[start_index]) - end - end - - end_index = transition_before_end(index + 1) - - if end_index - start_index = end_index unless start_index - - start_index.upto(transition_before_end(index + 1)) do |i| - if @transitions[i].local_start_at <= local - if i + 1 < @transitions.length - if @transitions[i + 1].local_end_at > local - result << TimezonePeriod.new(@transitions[i], @transitions[i + 1]) - end - else - result << TimezonePeriod.new(@transitions[i], nil) - end - end - end - end - - result - else - raise NoOffsetsDefined, 'No offsets have been defined' unless @previous_offset - [TimezonePeriod.new(nil, nil, @previous_offset)] - end - end - - # Returns an Array of TimezoneTransition instances representing the times - # where the UTC offset of the timezone changes. - # - # Transitions are returned up to a given date and time up to a given date - # and time, specified in UTC (utc_to). - # - # A from date and time may also be supplied using the utc_from parameter - # (also specified in UTC). If utc_from is not nil, only transitions from - # that date and time onwards will be returned. - # - # Comparisons with utc_to are exclusive. Comparisons with utc_from are - # inclusive. If a transition falls precisely on utc_to, it will be excluded. - # If a transition falls on utc_from, it will be included. - # - # Transitions returned are ordered by when they occur, from earliest to - # latest. - # - # utc_to and utc_from can be specified using either DateTime, Time or - # integer timestamps (Time.to_i). - # - # If utc_from is specified and utc_to is not greater than utc_from, then - # transitions_up_to raises an ArgumentError exception. - def transitions_up_to(utc_to, utc_from = nil) - utc_to = TimeOrDateTime.wrap(utc_to) - utc_from = utc_from ? TimeOrDateTime.wrap(utc_from) : nil - - if utc_from && utc_to <= utc_from - raise ArgumentError, 'utc_to must be greater than utc_from' - end - - unless @transitions.empty? - if utc_from - from = transition_after_start(transition_index(utc_from.year, utc_from.mon)) - - if from - while from < @transitions.length && @transitions[from].at < utc_from - from += 1 - end - - if from >= @transitions.length - return [] - end - else - # utc_from is later than last transition. - return [] - end - else - from = 0 - end - - to = transition_before_end(transition_index(utc_to.year, utc_to.mon)) - - if to - while to >= 0 && @transitions[to].at >= utc_to - to -= 1 - end - - if to < 0 - return [] - end - else - # utc_to is earlier than first transition. - return [] - end - - @transitions[from..to] - else - [] - end - end - - private - # Returns the index into the @transitions_index array for a given year - # and month. - def transition_index(year, month) - index = (year - @start_year) * 2 - index += 1 if month > 6 - index -= 1 if @start_month > 6 - index - end - - # Returns the index into @transitions of the first transition that occurs - # on or after the start of the given index into @transitions_index. - # Returns nil if there are no such transitions. - def transition_after_start(index) - if index >= @transitions_index.length - nil - else - index = 0 if index < 0 - @transitions_index[index] - end - end - - # Returns the index into @transitions of the first transition that occurs - # before the end of the given index into @transitions_index. - # Returns nil if there are no such transitions. - def transition_before_end(index) - index = index + 1 - - if index <= 0 - nil - elsif index >= @transitions_index.length - @transitions.length - 1 - else - @transitions_index[index] - 1 - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/transition_rule.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/transition_rule.rb deleted file mode 100644 index b8d160528b..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/transition_rule.rb +++ /dev/null @@ -1,325 +0,0 @@ -require 'date' - -module TZInfo - # Base class for rules definining the transition between standard and daylight - # savings time. - class TransitionRule #:nodoc: - # Returns the number of seconds after midnight local time on the day - # identified by the rule at which the transition occurs. Can be negative to - # denote a time on the prior day. Can be greater than or equal to 86,400 to - # denote a time of the following day. - attr_reader :transition_at - - # Initializes a new TransitionRule. - def initialize(transition_at) - raise ArgumentError, 'Invalid transition_at' unless transition_at.kind_of?(Integer) - @transition_at = transition_at - end - - # Calculates the UTC time of the transition from a given offset on a given - # year. - def at(offset, year) - day = get_day(year) - day.add_with_convert(@transition_at - offset.utc_total_offset) - end - - # Determines if this TransitionRule is equal to another instance. - def ==(r) - r.kind_of?(TransitionRule) && @transition_at == r.transition_at - end - alias eql? == - - # Returns a hash based on hash_args (defaulting to transition_at). - def hash - hash_args.hash - end - - protected - - # Returns an Array of parameters that will influence the output of hash. - def hash_args - [@transition_at] - end - - def new_time_or_datetime(year, month = 1, day = 1) - result = if ((year >= 2039 || (year == 2038 && (month >= 2 || (month == 1 && day >= 20)))) && !RubyCoreSupport.time_supports_64bit) || - (year < 1970 && !RubyCoreSupport.time_supports_negative) - - # Time handles 29 February on a non-leap year as 1 March. - # DateTime rejects. Advance manually. - if month == 2 && day == 29 && !Date.gregorian_leap?(year) - month = 3 - day = 1 - end - - RubyCoreSupport.datetime_new(year, month, day) - else - Time.utc(year, month, day) - end - - TimeOrDateTime.wrap(result) - end - end - - # A base class for transition rules that activate based on an integer day of - # the year. - # - # @private - class DayOfYearTransitionRule < TransitionRule #:nodoc: - # Initializes a new DayOfYearTransitionRule. - def initialize(day, transition_at) - super(transition_at) - raise ArgumentError, 'Invalid day' unless day.kind_of?(Integer) - @seconds = day * 86400 - end - - # Determines if this DayOfYearTransitionRule is equal to another instance. - def ==(r) - super(r) && r.kind_of?(DayOfYearTransitionRule) && @seconds == r.seconds - end - alias eql? == - - protected - - # @return [Integer] the day multipled by the number of seconds in a day. - attr_reader :seconds - - # Returns an Array of parameters that will influence the output of hash. - def hash_args - [@seconds] + super - end - end - - # Defines transitions that occur on the zero-based nth day of the year. - # - # Day 0 is 1 January. - # - # Leap days are counted. Day 59 will be 29 February on a leap year and 1 March - # on a non-leap year. Day 365 will be 31 December on a leap year and 1 January - # the following year on a non-leap year. - # - # @private - class AbsoluteDayOfYearTransitionRule < DayOfYearTransitionRule #:nodoc: - # Initializes a new AbsoluteDayOfYearTransitionRule. - def initialize(day, transition_at = 0) - super(day, transition_at) - raise ArgumentError, 'Invalid day' unless day >= 0 && day <= 365 - end - - # Returns true if the day specified by this transition is the first in the - # year (a day number of 0), otherwise false. - def is_always_first_day_of_year? - seconds == 0 - end - - # @returns false. - def is_always_last_day_of_year? - false - end - - # Determines if this AbsoluteDayOfYearTransitionRule is equal to another - # instance. - def ==(r) - super(r) && r.kind_of?(AbsoluteDayOfYearTransitionRule) - end - alias eql? == - - protected - - # Returns a TimeOrDateTime representing midnight local time on the day - # specified by the rule for the given offset and year. - def get_day(year) - new_time_or_datetime(year).add_with_convert(seconds) - end - - # Returns an Array of parameters that will influence the output of hash. - def hash_args - [AbsoluteDayOfYearTransitionRule] + super - end - end - - # Defines transitions that occur on the one-based nth Julian day of the year. - # - # Leap days are not counted. Day 1 is 1 January. Day 60 is always 1 March. - # Day 365 is always 31 December. - # - # @private - class JulianDayOfYearTransitionRule < DayOfYearTransitionRule #:nodoc: - # The 60 days in seconds. - LEAP = 60 * 86400 - - # The length of a non-leap year in seconds. - YEAR = 365 * 86400 - - # Initializes a new JulianDayOfYearTransitionRule. - def initialize(day, transition_at = 0) - super(day, transition_at) - raise ArgumentError, 'Invalid day' unless day >= 1 && day <= 365 - end - - # Returns true if the day specified by this transition is the first in the - # year (a day number of 1), otherwise false. - def is_always_first_day_of_year? - seconds == 86400 - end - - # Returns true if the day specified by this transition is the last in the - # year (a day number of 365), otherwise false. - def is_always_last_day_of_year? - seconds == YEAR - end - - # Determines if this JulianDayOfYearTransitionRule is equal to another - # instance. - def ==(r) - super(r) && r.kind_of?(JulianDayOfYearTransitionRule) - end - alias eql? == - - protected - - # Returns a TimeOrDateTime representing midnight local time on the day - # specified by the rule for the given offset and year. - def get_day(year) - # Returns 1 March on non-leap years. - leap = new_time_or_datetime(year, 2, 29) - diff = seconds - LEAP - diff += 86400 if diff >= 0 && leap.mday == 29 - leap.add_with_convert(diff) - end - - # Returns an Array of parameters that will influence the output of hash. - def hash_args - [JulianDayOfYearTransitionRule] + super - end - end - - # A base class for rules that transition on a particular day of week of a - # given week (subclasses specify which week of the month). - # - # @private - class DayOfWeekTransitionRule < TransitionRule #:nodoc: - # Initializes a new DayOfWeekTransitionRule. - def initialize(month, day_of_week, transition_at) - super(transition_at) - raise ArgumentError, 'Invalid month' unless month.kind_of?(Integer) && month >= 1 && month <= 12 - raise ArgumentError, 'Invalid day_of_week' unless day_of_week.kind_of?(Integer) && day_of_week >= 0 && day_of_week <= 6 - @month = month - @day_of_week = day_of_week - end - - # Returns false. - def is_always_first_day_of_year? - false - end - - # Returns false. - def is_always_last_day_of_year? - false - end - - # Determines if this DayOfWeekTransitionRule is equal to another instance. - def ==(r) - super(r) && r.kind_of?(DayOfWeekTransitionRule) && @month == r.month && @day_of_week == r.day_of_week - end - alias eql? == - - protected - - # Returns the month of the year (1 to 12). - attr_reader :month - - # Returns the day of the week (0 to 6 for Sunday to Monday). - attr_reader :day_of_week - - # Returns an Array of parameters that will influence the output of hash. - def hash_args - [@month, @day_of_week] + super - end - end - - # A rule that transitions on the nth occurrence of a particular day of week - # of a calendar month. - # - # @private - class DayOfMonthTransitionRule < DayOfWeekTransitionRule #:nodoc: - # Initializes a new DayOfMonthTransitionRule. - def initialize(month, week, day_of_week, transition_at = 0) - super(month, day_of_week, transition_at) - raise ArgumentError, 'Invalid week' unless week.kind_of?(Integer) && week >= 1 && week <= 4 - @offset_start = (week - 1) * 7 + 1 - end - - # Determines if this DayOfMonthTransitionRule is equal to another instance. - def ==(r) - super(r) && r.kind_of?(DayOfMonthTransitionRule) && @offset_start == r.offset_start - end - alias eql? == - - protected - - # Returns the day the week starts on for a month starting on a Sunday. - attr_reader :offset_start - - # Returns a TimeOrDateTime representing midnight local time on the day - # specified by the rule for the given offset and year. - def get_day(year) - candidate = new_time_or_datetime(year, month, @offset_start) - diff = day_of_week - candidate.wday - - if diff < 0 - candidate.add_with_convert((7 + diff) * 86400) - elsif diff > 0 - candidate.add_with_convert(diff * 86400) - else - candidate - end - end - - # Returns an Array of parameters that will influence the output of hash. - def hash_args - [@offset_start] + super - end - end - - # A rule that transitions on the last occurrence of a particular day of week - # of a calendar month. - # - # @private - class LastDayOfMonthTransitionRule < DayOfWeekTransitionRule #:nodoc: - # Initializes a new LastDayOfMonthTransitionRule. - def initialize(month, day_of_week, transition_at = 0) - super(month, day_of_week, transition_at) - end - - # Determines if this LastDayOfMonthTransitionRule is equal to another - # instance. - def ==(r) - super(r) && r.kind_of?(LastDayOfMonthTransitionRule) - end - alias eql? == - - protected - - # Returns a TimeOrDateTime representing midnight local time on the day - # specified by the rule for the given offset and year. - def get_day(year) - next_month = month + 1 - if next_month == 13 - year += 1 - next_month = 1 - end - - candidate = new_time_or_datetime(year, next_month).add_with_convert(-86400) - diff = candidate.wday - day_of_week - - if diff < 0 - candidate - (diff + 7) * 86400 - elsif diff > 0 - candidate - diff * 86400 - else - candidate - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/zoneinfo_country_info.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/zoneinfo_country_info.rb deleted file mode 100644 index c99acaa8ed..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/zoneinfo_country_info.rb +++ /dev/null @@ -1,37 +0,0 @@ -module TZInfo - # Represents information about a country returned by ZoneinfoDataSource. - # - # @private - class ZoneinfoCountryInfo < CountryInfo #:nodoc: - # Constructs a new CountryInfo with an ISO 3166 country code, name and - # an array of CountryTimezones. - def initialize(code, name, zones) - super(code, name) - @zones = zones.dup.freeze - @zone_identifiers = nil - end - - # Returns a frozen array of all the zone identifiers for the country ordered - # geographically, most populous first. - def zone_identifiers - # Thread-safety: It is possible that the value of @zone_identifiers may be - # calculated multiple times in concurrently executing threads. It is not - # worth the overhead of locking to ensure that @zone_identifiers is only - # calculated once. - - unless @zone_identifiers - result = zones.collect {|zone| zone.identifier}.freeze - return result if frozen? - @zone_identifiers = result - end - - @zone_identifiers - end - - # Returns a frozen array of all the timezones for the for the country - # ordered geographically, most populous first. - def zones - @zones - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/zoneinfo_data_source.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/zoneinfo_data_source.rb deleted file mode 100644 index 3959090f81..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/zoneinfo_data_source.rb +++ /dev/null @@ -1,497 +0,0 @@ -module TZInfo - # Use send as a workaround for an issue on JRuby 9.2.9.0 where using the - # refinement causes calls to RubyCoreSupport.file_open to fail to pass the - # block parameter. - # - # https://travis-ci.org/tzinfo/tzinfo/jobs/628812051#L1931 - # https://github.com/jruby/jruby/issues/6009 - send(:using, TZInfo::RubyCoreSupport::UntaintExt) if TZInfo::RubyCoreSupport.const_defined?(:UntaintExt) - - # An InvalidZoneinfoDirectory exception is raised if the DataSource is - # set to a specific zoneinfo path, which is not a valid zoneinfo directory - # (i.e. a directory containing index files named iso3166.tab and zone.tab - # as well as other timezone files). - class InvalidZoneinfoDirectory < StandardError - end - - # A ZoneinfoDirectoryNotFound exception is raised if no valid zoneinfo - # directory could be found when checking the paths listed in - # ZoneinfoDataSource.search_path. A valid zoneinfo directory is one that - # contains timezone files, a country code index file named iso3166.tab and a - # timezone index file named zone1970.tab or zone.tab. - class ZoneinfoDirectoryNotFound < StandardError - end - - # A DataSource that loads data from a 'zoneinfo' directory containing - # compiled "TZif" version 3 (or earlier) files in addition to iso3166.tab and - # zone1970.tab or zone.tab index files. - # - # To have TZInfo load the system zoneinfo files, call TZInfo::DataSource.set - # as follows: - # - # TZInfo::DataSource.set(:zoneinfo) - # - # To load zoneinfo files from a particular directory, pass the directory to - # TZInfo::DataSource.set: - # - # TZInfo::DataSource.set(:zoneinfo, directory) - # - # Note that the platform used at runtime may limit the range of available - # transition data that can be loaded from zoneinfo files. There are two - # factors to consider: - # - # First of all, the zoneinfo support in TZInfo makes use of Ruby's Time class. - # On 32-bit builds of Ruby 1.8, the Time class only supports 32-bit - # timestamps. This means that only Times between 1901-12-13 20:45:52 and - # 2038-01-19 03:14:07 can be represented. Furthermore, certain platforms only - # allow for positive 32-bit timestamps (notably Windows), making the earliest - # representable time 1970-01-01 00:00:00. - # - # 64-bit builds of Ruby 1.8 and all builds of Ruby 1.9 support 64-bit - # timestamps. This means that there is no practical restriction on the range - # of the Time class on these platforms. - # - # TZInfo will only load transitions that fall within the supported range of - # the Time class. Any queries performed on times outside of this range may - # give inaccurate results. - # - # The second factor concerns the zoneinfo files. Versions of the 'zic' tool - # (used to build zoneinfo files) that were released prior to February 2006 - # created zoneinfo files that used 32-bit integers for transition timestamps. - # Later versions of zic produce zoneinfo files that use 64-bit integers. If - # you have 32-bit zoneinfo files on your system, then any queries falling - # outside of the range 1901-12-13 20:45:52 to 2038-01-19 03:14:07 may be - # inaccurate. - # - # Most modern platforms include 64-bit zoneinfo files. However, Mac OS X (up - # to at least 10.8.4) still uses 32-bit zoneinfo files. - # - # To check whether your zoneinfo files contain 32-bit or 64-bit transition - # data, you can run the following code (substituting the identifier of the - # zone you want to test for zone_identifier): - # - # TZInfo::DataSource.set(:zoneinfo) - # dir = TZInfo::DataSource.get.zoneinfo_dir - # File.open(File.join(dir, zone_identifier), 'r') {|f| f.read(5) } - # - # If the last line returns "TZif\\x00", then you have a 32-bit zoneinfo file. - # If it returns "TZif2" or "TZif3" then you have a 64-bit zoneinfo file. - # - # If you require support for 64-bit transitions, but are restricted to 32-bit - # zoneinfo support, then you may want to consider using TZInfo::RubyDataSource - # instead. - class ZoneinfoDataSource < DataSource - # The default value of ZoneinfoDataSource.search_path. - DEFAULT_SEARCH_PATH = ['/usr/share/zoneinfo', '/usr/share/lib/zoneinfo', '/etc/zoneinfo'].freeze - - # The default value of ZoneinfoDataSource.alternate_iso3166_tab_search_path. - DEFAULT_ALTERNATE_ISO3166_TAB_SEARCH_PATH = ['/usr/share/misc/iso3166.tab', '/usr/share/misc/iso3166'].freeze - - # Paths to be checked to find the system zoneinfo directory. - @@search_path = DEFAULT_SEARCH_PATH.dup - - # Paths to possible alternate iso3166.tab files (used to locate the - # system-wide iso3166.tab files on FreeBSD and OpenBSD). - @@alternate_iso3166_tab_search_path = DEFAULT_ALTERNATE_ISO3166_TAB_SEARCH_PATH.dup - - # An Array of directories that will be checked to find the system zoneinfo - # directory. - # - # Directories are checked in the order they appear in the Array. - # - # The default value is ['/usr/share/zoneinfo', '/usr/share/lib/zoneinfo', '/etc/zoneinfo']. - def self.search_path - @@search_path - end - - # Sets the directories to be checked when locating the system zoneinfo - # directory. - # - # Can be set to an Array of directories or a String containing directories - # separated with File::PATH_SEPARATOR. - # - # Directories are checked in the order they appear in the Array or String. - # - # Set to nil to revert to the default paths. - def self.search_path=(search_path) - @@search_path = process_search_path(search_path, DEFAULT_SEARCH_PATH) - end - - # An Array of paths that will be checked to find an alternate iso3166.tab - # file if one was not included in the zoneinfo directory (for example, on - # FreeBSD and OpenBSD systems). - # - # Paths are checked in the order they appear in the array. - # - # The default value is ['/usr/share/misc/iso3166.tab', '/usr/share/misc/iso3166']. - def self.alternate_iso3166_tab_search_path - @@alternate_iso3166_tab_search_path - end - - # Sets the paths to check to locate an alternate iso3166.tab file if one was - # not included in the zoneinfo directory. - # - # Can be set to an Array of directories or a String containing directories - # separated with File::PATH_SEPARATOR. - # - # Paths are checked in the order they appear in the array. - # - # Set to nil to revert to the default paths. - def self.alternate_iso3166_tab_search_path=(alternate_iso3166_tab_search_path) - @@alternate_iso3166_tab_search_path = process_search_path(alternate_iso3166_tab_search_path, DEFAULT_ALTERNATE_ISO3166_TAB_SEARCH_PATH) - end - - # The zoneinfo directory being used. - attr_reader :zoneinfo_dir - - # Creates a new ZoneinfoDataSource. - # - # If zoneinfo_dir is specified, it will be checked and used as the source - # of zoneinfo files. - # - # The directory must contain a file named iso3166.tab and a file named - # either zone1970.tab or zone.tab. These may either be included in the root - # of the directory or in a 'tab' sub-directory and named 'country.tab' and - # 'zone_sun.tab' respectively (as is the case on Solaris. - # - # Additionally, the path to iso3166.tab can be overridden using the - # alternate_iso3166_tab_path parameter. - # - # InvalidZoneinfoDirectory will be raised if the iso3166.tab and - # zone1970.tab or zone.tab files cannot be found using the zoneinfo_dir and - # alternate_iso3166_tab_path parameters. - # - # If zoneinfo_dir is not specified or nil, the paths referenced in - # search_path are searched in order to find a valid zoneinfo directory - # (one that contains zone1970.tab or zone.tab and iso3166.tab files as - # above). - # - # The paths referenced in alternate_iso3166_tab_search_path are also - # searched to find an iso3166.tab file if one of the searched zoneinfo - # directories doesn't contain an iso3166.tab file. - # - # If no valid directory can be found by searching, ZoneinfoDirectoryNotFound - # will be raised. - def initialize(zoneinfo_dir = nil, alternate_iso3166_tab_path = nil) - if zoneinfo_dir - iso3166_tab_path, zone_tab_path = validate_zoneinfo_dir(zoneinfo_dir, alternate_iso3166_tab_path) - - unless iso3166_tab_path && zone_tab_path - raise InvalidZoneinfoDirectory, "#{zoneinfo_dir} is not a directory or doesn't contain a iso3166.tab file and a zone1970.tab or zone.tab file." - end - - @zoneinfo_dir = zoneinfo_dir - else - @zoneinfo_dir, iso3166_tab_path, zone_tab_path = find_zoneinfo_dir - - unless @zoneinfo_dir && iso3166_tab_path && zone_tab_path - raise ZoneinfoDirectoryNotFound, "None of the paths included in TZInfo::ZoneinfoDataSource.search_path are valid zoneinfo directories." - end - end - - @zoneinfo_dir = File.expand_path(@zoneinfo_dir).freeze - @timezone_index = load_timezone_index.freeze - @country_index = load_country_index(iso3166_tab_path, zone_tab_path).freeze - @posix_tz_parser = PosixTimeZoneParser.new - end - - # Returns a TimezoneInfo instance for a given identifier. - # Raises InvalidTimezoneIdentifier if the timezone is not found or the - # identifier is invalid. - def load_timezone_info(identifier) - begin - if @timezone_index.include?(identifier) - path = File.join(@zoneinfo_dir, identifier) - - # Untaint path rather than identifier. We don't want to modify - # identifier. identifier may also be frozen and therefore cannot be - # untainted. - path.untaint - - begin - ZoneinfoTimezoneInfo.new(identifier, path, @posix_tz_parser) - rescue InvalidZoneinfoFile => e - raise InvalidTimezoneIdentifier, e.message - end - else - raise InvalidTimezoneIdentifier, 'Invalid identifier' - end - rescue Errno::ENOENT, Errno::ENAMETOOLONG, Errno::ENOTDIR - raise InvalidTimezoneIdentifier, 'Invalid identifier' - rescue Errno::EACCES => e - raise InvalidTimezoneIdentifier, e.message - end - end - - # Returns an array of all the available timezone identifiers. - def timezone_identifiers - @timezone_index - end - - # Returns an array of all the available timezone identifiers for - # data timezones (i.e. those that actually contain definitions). - # - # For ZoneinfoDataSource, this will always be identical to - # timezone_identifers. - def data_timezone_identifiers - @timezone_index - end - - # Returns an array of all the available timezone identifiers that - # are links to other timezones. - # - # For ZoneinfoDataSource, this will always be an empty array. - def linked_timezone_identifiers - [].freeze - end - - # Returns a CountryInfo instance for the given ISO 3166-1 alpha-2 - # country code. Raises InvalidCountryCode if the country could not be found - # or the code is invalid. - def load_country_info(code) - info = @country_index[code] - raise InvalidCountryCode, 'Invalid country code' unless info - info - end - - # Returns an array of all the available ISO 3166-1 alpha-2 - # country codes. - def country_codes - @country_index.keys.freeze - end - - # Returns the name and information about this DataSource. - def to_s - "Zoneinfo DataSource: #{@zoneinfo_dir}" - end - - # Returns internal object state as a programmer-readable string. - def inspect - "#<#{self.class}: #{@zoneinfo_dir}>" - end - - private - - # Processes a path for use as the search_path or - # alternate_iso3166_tab_search_path. - def self.process_search_path(path, default) - if path - if path.kind_of?(String) - path.split(File::PATH_SEPARATOR) - else - path.collect {|p| p.to_s} - end - else - default.dup - end - end - - # Validates a zoneinfo directory and returns the paths to the iso3166.tab - # and zone1970.tab or zone.tab files if valid. If the directory is not - # valid, returns nil. - # - # The path to the iso3166.tab file may be overriden by passing in a path. - # This is treated as either absolute or relative to the current working - # directory. - def validate_zoneinfo_dir(path, iso3166_tab_path = nil) - if File.directory?(path) - if iso3166_tab_path - return nil unless File.file?(iso3166_tab_path) - else - iso3166_tab_path = resolve_tab_path(path, ['iso3166.tab'], 'country.tab') - return nil unless iso3166_tab_path - end - - zone_tab_path = resolve_tab_path(path, ['zone1970.tab', 'zone.tab'], 'zone_sun.tab') - return nil unless zone_tab_path - - [iso3166_tab_path, zone_tab_path] - else - nil - end - end - - # Attempts to resolve the path to a tab file given its standard names and - # tab sub-directory name (as used on Solaris). - def resolve_tab_path(zoneinfo_path, standard_names, tab_name) - standard_names.each do |standard_name| - path = File.join(zoneinfo_path, standard_name) - return path if File.file?(path) - end - - path = File.join(zoneinfo_path, 'tab', tab_name) - return path if File.file?(path) - - nil - end - - # Finds a zoneinfo directory using search_path and - # alternate_iso3166_tab_search_path. Returns the paths to the directory, - # the iso3166.tab file and the zone.tab file or nil if not found. - def find_zoneinfo_dir - alternate_iso3166_tab_path = self.class.alternate_iso3166_tab_search_path.detect do |path| - File.file?(path) - end - - self.class.search_path.each do |path| - # Try without the alternate_iso3166_tab_path first. - iso3166_tab_path, zone_tab_path = validate_zoneinfo_dir(path) - return path, iso3166_tab_path, zone_tab_path if iso3166_tab_path && zone_tab_path - - if alternate_iso3166_tab_path - iso3166_tab_path, zone_tab_path = validate_zoneinfo_dir(path, alternate_iso3166_tab_path) - return path, iso3166_tab_path, zone_tab_path if iso3166_tab_path && zone_tab_path - end - end - - # Not found. - nil - end - - # Scans @zoneinfo_dir and returns an Array of available timezone - # identifiers. - def load_timezone_index - index = [] - - # Ignoring particular files: - # +VERSION is included on Mac OS X. - # leapseconds is a list of leap seconds. - # localtime is the current local timezone (may be a link). - # posix, posixrules and right are directories containing other versions of the zoneinfo files. - # src is a directory containing the tzdata source included on Solaris. - # timeconfig is a symlink included on Slackware. - - enum_timezones(nil, ['+VERSION', 'leapseconds', 'localtime', 'posix', 'posixrules', 'right', 'src', 'timeconfig']) do |identifier| - index << identifier - end - - index.sort - end - - # Recursively scans a directory of timezones, calling the passed in block - # for each identifier found. - def enum_timezones(dir, exclude = [], &block) - Dir.foreach(dir ? File.join(@zoneinfo_dir, dir) : @zoneinfo_dir) do |entry| - unless entry =~ /\./ || exclude.include?(entry) - entry.untaint - path = dir ? File.join(dir, entry) : entry - full_path = File.join(@zoneinfo_dir, path) - - if File.directory?(full_path) - enum_timezones(path, [], &block) - elsif File.file?(full_path) - yield path - end - end - end - end - - # Uses the iso3166.tab and zone1970.tab or zone.tab files to build an index - # of the available countries and their timezones. - def load_country_index(iso3166_tab_path, zone_tab_path) - - # Handle standard 3 to 4 column zone.tab files as well as the 4 to 5 - # column format used by Solaris. - # - # On Solaris, an extra column before the comment gives an optional - # linked/alternate timezone identifier (or '-' if not set). - # - # Additionally, there is a section at the end of the file for timezones - # covering regions. These are given lower-case "country" codes. The timezone - # identifier column refers to a continent instead of an identifier. These - # lines will be ignored by TZInfo. - # - # Since the last column is optional in both formats, testing for the - # Solaris format is done in two passes. The first pass identifies if there - # are any lines using 5 columns. - - - # The first column is allowed to be a comma separated list of country - # codes, as used in zone1970.tab (introduced in tzdata 2014f). - # - # The first country code in the comma-separated list is the country that - # contains the city the zone identifer is based on. The first country - # code on each line is considered to be primary with the others - # secondary. - # - # The zones for each country are ordered primary first, then secondary. - # Within the primary and secondary groups, the zones are ordered by their - # order in the file. - - file_is_5_column = false - zone_tab = [] - - RubyCoreSupport.open_file(zone_tab_path, 'r', :external_encoding => 'UTF-8', :internal_encoding => 'UTF-8') do |file| - file.each_line do |line| - line.chomp! - - if line =~ /\A([A-Z]{2}(?:,[A-Z]{2})*)\t(?:([+\-])(\d{2})(\d{2})([+\-])(\d{3})(\d{2})|([+\-])(\d{2})(\d{2})(\d{2})([+\-])(\d{3})(\d{2})(\d{2}))\t([^\t]+)(?:\t([^\t]+))?(?:\t([^\t]+))?\z/ - codes = $1 - - if $2 - latitude = dms_to_rational($2, $3, $4) - longitude = dms_to_rational($5, $6, $7) - else - latitude = dms_to_rational($8, $9, $10, $11) - longitude = dms_to_rational($12, $13, $14, $15) - end - - zone_identifier = $16 - column4 = $17 - column5 = $18 - - file_is_5_column = true if column5 - - zone_tab << [codes.split(','.freeze), zone_identifier, latitude, longitude, column4, column5] - end - end - end - - primary_zones = {} - secondary_zones = {} - - zone_tab.each do |codes, zone_identifier, latitude, longitude, column4, column5| - description = file_is_5_column ? column5 : column4 - country_timezone = CountryTimezone.new(zone_identifier, latitude, longitude, description) - - # codes will always have at least one element - - (primary_zones[codes.first] ||= []) << country_timezone - - codes[1..-1].each do |code| - (secondary_zones[code] ||= []) << country_timezone - end - end - - countries = {} - - RubyCoreSupport.open_file(iso3166_tab_path, 'r', :external_encoding => 'UTF-8', :internal_encoding => 'UTF-8') do |file| - file.each_line do |line| - line.chomp! - - # Handle both the two column alpha-2 and name format used in the tz - # database as well as the 4 column alpha-2, alpha-3, numeric-3 and - # name format used by FreeBSD and OpenBSD. - - if line =~ /\A([A-Z]{2})(?:\t[A-Z]{3}\t[0-9]{3})?\t(.+)\z/ - code = $1 - name = $2 - zones = (primary_zones[code] || []) + (secondary_zones[code] || []) - - countries[code] = ZoneinfoCountryInfo.new(code, name, zones) - end - end - end - - countries - end - - # Converts degrees, minutes and seconds to a Rational. - def dms_to_rational(sign, degrees, minutes, seconds = nil) - result = degrees.to_i + Rational(minutes.to_i, 60) - result += Rational(seconds.to_i, 3600) if seconds - result = -result if sign == '-'.freeze - result - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/zoneinfo_timezone_info.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/zoneinfo_timezone_info.rb deleted file mode 100644 index 4f28a19c2a..0000000000 --- a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-1.2.8/lib/tzinfo/zoneinfo_timezone_info.rb +++ /dev/null @@ -1,515 +0,0 @@ -module TZInfo - # Use send as a workaround for erroneous 'wrong number of arguments' errors - # with JRuby 9.0.5.0 when calling methods with Java implementations. See #114. - send(:using, RubyCoreSupport::UntaintExt) if RubyCoreSupport.const_defined?(:UntaintExt) - - # An InvalidZoneinfoFile exception is raised if an attempt is made to load an - # invalid zoneinfo file. - class InvalidZoneinfoFile < StandardError - end - - # Represents a timezone defined by a compiled zoneinfo TZif (\0, 2 or 3) file. - # - # @private - class ZoneinfoTimezoneInfo < TransitionDataTimezoneInfo #:nodoc: - # The year to generate transitions up to. - # - # @private - GENERATE_UP_TO = RubyCoreSupport.time_supports_64bit ? Time.now.utc.year + 100 : 2037 - - # Minimum supported timestamp (inclusive). - # - # Time.utc(1700, 1, 1).to_i - MIN_TIMESTAMP = -8520336000 - - # Maximum supported timestamp (exclusive). - # - # Time.utc(2500, 1, 1).to_i - MAX_TIMESTAMP = 16725225600 - - # Constructs the new ZoneinfoTimezoneInfo with an identifier, path - # to the file and parser to use to parse the POSIX-like TZ string. - def initialize(identifier, file_path, posix_tz_parser) - super(identifier) - - File.open(file_path, 'rb') do |file| - parse(file, posix_tz_parser) - end - end - - private - # Unpack will return unsigned 32-bit integers. Translate to - # signed 32-bit. - def make_signed_int32(long) - long >= 0x80000000 ? long - 0x100000000 : long - end - - # Unpack will return a 64-bit integer as two unsigned 32-bit integers - # (most significant first). Translate to signed 64-bit - def make_signed_int64(high, low) - unsigned = (high << 32) | low - unsigned >= 0x8000000000000000 ? unsigned - 0x10000000000000000 : unsigned - end - - # Read bytes from file and check that the correct number of bytes could - # be read. Raises InvalidZoneinfoFile if the number of bytes didn't match - # the number requested. - def check_read(file, bytes) - result = file.read(bytes) - - unless result && result.length == bytes - raise InvalidZoneinfoFile, "Expected #{bytes} bytes reading '#{file.path}', but got #{result ? result.length : 0} bytes" - end - - result - end - - # Zoneinfo files don't include the offset from standard time (std_offset) - # for DST periods. Derive the base offset (utc_offset) where DST is - # observed from either the previous or next non-DST period. - # - # Returns the index of the offset to be used prior to the first - # transition. - def derive_offsets(transitions, offsets) - # The first non-DST offset (if there is one) is the offset observed - # before the first transition. Fallback to the first DST offset if there - # are no non-DST offsets. - first_non_dst_offset_index = offsets.index {|o| !o[:is_dst] } - first_offset_index = first_non_dst_offset_index || 0 - return first_offset_index if transitions.empty? - - # Determine the utc_offset of the next non-dst offset at each transition. - utc_offset_from_next = nil - - transitions.reverse_each do |transition| - offset = offsets[transition[:offset]] - if offset[:is_dst] - transition[:utc_offset_from_next] = utc_offset_from_next if utc_offset_from_next - else - utc_offset_from_next = offset[:utc_total_offset] - end - end - - utc_offset_from_previous = first_non_dst_offset_index ? offsets[first_non_dst_offset_index][:utc_total_offset] : nil - defined_offsets = {} - - transitions.each do |transition| - offset_index = transition[:offset] - offset = offsets[offset_index] - utc_total_offset = offset[:utc_total_offset] - - if offset[:is_dst] - utc_offset_from_next = transition[:utc_offset_from_next] - - difference_to_previous = (utc_total_offset - (utc_offset_from_previous || utc_total_offset)).abs - difference_to_next = (utc_total_offset - (utc_offset_from_next || utc_total_offset)).abs - - utc_offset = if difference_to_previous == 3600 - utc_offset_from_previous - elsif difference_to_next == 3600 - utc_offset_from_next - elsif difference_to_previous > 0 && difference_to_next > 0 - difference_to_previous < difference_to_next ? utc_offset_from_previous : utc_offset_from_next - elsif difference_to_previous > 0 - utc_offset_from_previous - elsif difference_to_next > 0 - utc_offset_from_next - else - # No difference, assume a 1 hour offset from standard time. - utc_total_offset - 3600 - end - - if !offset[:utc_offset] - offset[:utc_offset] = utc_offset - defined_offsets[offset] = offset_index - elsif offset[:utc_offset] != utc_offset - # An earlier transition has already derived a different - # utc_offset. Define a new offset or reuse an existing identically - # defined offset. - new_offset = offset.dup - new_offset[:utc_offset] = utc_offset - - offset_index = defined_offsets[new_offset] - - unless offset_index - offsets << new_offset - offset_index = offsets.length - 1 - defined_offsets[new_offset] = offset_index - end - - transition[:offset] = offset_index - end - else - utc_offset_from_previous = utc_total_offset - end - end - - first_offset_index - end - - # Remove transitions before a minimum supported value. If there is not a - # transition exactly on the minimum supported value move the latest from - # before up to the minimum supported value. - def remove_unsupported_negative_transitions(transitions, min_supported) - result = transitions.drop_while {|t| t[:at] < min_supported } - if result.empty? || (result[0][:at] > min_supported && result.length < transitions.length) - last_before = transitions[-1 - result.length] - last_before[:at] = min_supported - [last_before] + result - else - result - end - end - - # Determines if the offset from a transition matches the offset from a - # rule. This is a looser match than TimezoneOffset#==, not requiring that - # the utc_offset and std_offset both match (which have to be derived for - # transitions, but are known for rules. - def offset_matches_rule?(offset, rule_offset) - offset[:utc_total_offset] == rule_offset.utc_total_offset && - offset[:is_dst] == rule_offset.dst? && - offset[:abbr] == rule_offset.abbreviation.to_s - end - - # Determins if the offset from a transition exactly matches the offset - # from a rule. - def offset_equals_rule?(offset, rule_offset) - offset_matches_rule?(offset, rule_offset) && - (offset[:utc_offset] || (offset[:is_dst] ? offset[:utc_total_offset] - 3600 : offset[:utc_total_offset])) == rule_offset.utc_offset - end - - # Finds an offset hash that is an exact match to the rule offset specified. - def find_existing_offset_index(offsets, rule_offset) - offsets.find_index {|o| offset_equals_rule?(o, rule_offset) } - end - - # Gets an existing matching offset index or adds a new offset hash for a - # rule offset. - def get_rule_offset_index(offsets, offset) - index = find_existing_offset_index(offsets, offset) - unless index - index = offsets.length - offsets << {:utc_total_offset => offset.utc_total_offset, :utc_offset => offset.utc_offset, :is_dst => offset.dst?, :abbr => offset.abbreviation} - end - index - end - - # Gets a hash mapping rule offsets to indexes in offsets, creating new - # offset hashes if required. - def get_rule_offset_indexes(offsets, annual_rules) - { - annual_rules.std_offset => get_rule_offset_index(offsets, annual_rules.std_offset), - annual_rules.dst_offset => get_rule_offset_index(offsets, annual_rules.dst_offset) - } - end - - # Converts an array of rule transitions to hashes. - def convert_transitions_to_hashes(offset_indexes, transitions) - transitions.map {|t| {:at => t.at.to_i, :offset => offset_indexes[t.offset]} } - end - - # Apply the rules from the TZ string when there were no defined - # transitions. Checks for a matching offset. Returns the rules-based - # constant offset or generates transitions from 1970 until 100 years into - # the future (at the time of loading zoneinfo_timezone_info.rb) or 2037 if - # limited to 32-bit Times. - def apply_rules_without_transitions(file, offsets, first_offset_index, rules) - first_offset = offsets[first_offset_index] - - if rules.kind_of?(TimezoneOffset) - unless offset_matches_rule?(first_offset, rules) - raise InvalidZoneinfoFile, "Constant offset POSIX-style TZ string does not match constant offset in file '#{file.path}'." - end - - first_offset[:utc_offset] = rules.utc_offset - [] - else - transitions = 1970.upto(GENERATE_UP_TO).map {|y| rules.transitions(y) }.flatten - first_transition = transitions[0] - - if offset_matches_rule?(first_offset, first_transition.previous_offset) - # Correct the first offset if it isn't an exact match. - first_offset[:utc_offset] = first_transition.previous_offset.utc_offset - else - # Not transitioning from the designated first offset. - if offset_matches_rule?(first_offset, first_transition.offset) - # Correct the first offset if it isn't an exact match. - first_offset[:utc_offset] = first_transition.offset.utc_offset - - # Skip an unnecessary transition to the first offset. - transitions.shift - end - - # If the first offset doesn't match either the offset or previous - # offset, then it will be retained. - end - - offset_indexes = get_rule_offset_indexes(offsets, rules) - convert_transitions_to_hashes(offset_indexes, transitions) - end - end - - # Validates the rules offset against the offset of the last defined - # transition. Replaces the transition with an equivalent using the rules - # offset if the rules give a different definition for the base offset. - def replace_last_transition_offset_if_valid_and_needed(file, transitions, offsets) - last_transition = transitions.last - last_offset = offsets[last_transition[:offset]] - rule_offset = yield last_offset - - unless offset_matches_rule?(last_offset, rule_offset) - raise InvalidZoneinfoFile, "Offset from POSIX-style TZ string does not match final transition in file '#{file.path}'." - end - - # The total_utc_offset and abbreviation must always be the same. The - # base utc_offset and std_offset might differ. In which case the rule - # should be used as it will be more precise. - last_offset[:utc_offset] = rule_offset.utc_offset - last_transition - end - - # todo: port over validate_and_fix_last_defined_transition_offset - # when fixing the previous offset will need to define a new one - - # Validates the offset indicated to be observed by the rules before the - # first generated transition against the offset of the last defined - # transition. - # - # Fix the last defined transition if it differ on just base/std offsets - # (which are derived). Raise an error if the observed UTC offset or - # abbreviations differ. - def validate_and_fix_last_defined_transition_offset(file, offsets, last_defined, first_rule_offset) - offset_of_last_defined = offsets[last_defined[:offset]] - - if offset_equals_rule?(offset_of_last_defined, first_rule_offset) - last_defined - else - if offset_matches_rule?(offset_of_last_defined, first_rule_offset) - # The same overall offset, but differing in the base or std - # offset (which are derived). Correct by using the rule. - - offset_index = get_rule_offset_index(offsets, first_rule_offset) - {:at => last_defined[:at], :offset => offset_index} - else - raise InvalidZoneinfoFile, "The first offset indicated by the POSIX-style TZ string did not match the final defined offset in file '#{file.path}'." - end - end - end - - # Apply the rules from the TZ string when there were defined transitions. - # Checks for a matching offset with the last transition. Redefines the - # last transition if required and if the rules don't specific a constant - # offset, generates transitions until 100 years into the future (at the - # time of loading zoneinfo_timezone_info.rb) or 2037 if limited to 32-bit - # Times. - def apply_rules_with_transitions(file, transitions, offsets, first_offset_index, rules) - last_defined = transitions[-1] - - if rules.kind_of?(TimezoneOffset) - transitions[-1] = validate_and_fix_last_defined_transition_offset(file, offsets, last_defined, rules) - else - previous_offset_index = transitions.length > 1 ? transitions[-2][:offset] : first_offset_index - previous_offset = offsets[previous_offset_index] - last_year = (Time.at(last_defined[:at]).utc + previous_offset[:utc_total_offset]).year - - if last_year <= GENERATE_UP_TO - generated = rules.transitions(last_year).find_all {|t| t.at > last_defined[:at] } + - (last_year + 1).upto(GENERATE_UP_TO).map {|y| rules.transitions(y) }.flatten - - unless generated.empty? - transitions[-1] = validate_and_fix_last_defined_transition_offset(file, offsets, last_defined, generated[0].previous_offset) - rule_offset_indexes = get_rule_offset_indexes(offsets, rules) - transitions.concat(convert_transitions_to_hashes(rule_offset_indexes, generated)) - end - end - end - end - - # Defines an offset for the timezone based on the given index and offset - # Hash. - def define_offset(index, offset) - utc_total_offset = offset[:utc_total_offset] - utc_offset = offset[:utc_offset] - - if utc_offset - # DST offset with base utc_offset derived by derive_offsets. - std_offset = utc_total_offset - utc_offset - elsif offset[:is_dst] - # DST offset unreferenced by a transition (offset in use before the - # first transition). No derived base UTC offset, so assume 1 hour - # DST. - utc_offset = utc_total_offset - 3600 - std_offset = 3600 - else - # Non-DST offset. - utc_offset = utc_total_offset - std_offset = 0 - end - - offset index, utc_offset, std_offset, offset[:abbr].untaint.to_sym - end - - # Parses a zoneinfo file and intializes the DataTimezoneInfo structures. - def parse(file, posix_tz_parser) - magic, version, ttisutccnt, ttisstdcnt, leapcnt, timecnt, typecnt, charcnt = - check_read(file, 44).unpack('a4 a x15 NNNNNN') - - if magic != 'TZif' - raise InvalidZoneinfoFile, "The file '#{file.path}' does not start with the expected header." - end - - if version == '2' || version == '3' - # Skip the first 32-bit section and read the header of the second - # 64-bit section. The 64-bit section is always used even if the - # runtime platform doesn't support 64-bit timestamps. In "slim" format - # zoneinfo files the 32-bit section will be empty. - file.seek(timecnt * 5 + typecnt * 6 + charcnt + leapcnt * 8 + ttisstdcnt + ttisutccnt, IO::SEEK_CUR) - - prev_version = version - - magic, version, ttisutccnt, ttisstdcnt, leapcnt, timecnt, typecnt, charcnt = - check_read(file, 44).unpack('a4 a x15 NNNNNN') - - unless magic == 'TZif' && (version == prev_version) - raise InvalidZoneinfoFile, "The file '#{file.path}' contains an invalid 64-bit section header." - end - - using_64bit = true - elsif version != '3' && version != '2' && version != "\0" - raise InvalidZoneinfoFile, "The file '#{file.path}' contains a version of the zoneinfo format that is not currently supported." - else - using_64bit = false - end - - unless leapcnt == 0 - raise InvalidZoneinfoFile, "The zoneinfo file '#{file.path}' contains leap second data. TZInfo requires zoneinfo files that omit leap seconds." - end - - transitions = [] - - if using_64bit - timecnt.times do |i| - high, low = check_read(file, 8).unpack('NN'.freeze) - transition_time = make_signed_int64(high, low) - transitions << {:at => transition_time} - end - else - timecnt.times do |i| - transition_time = make_signed_int32(check_read(file, 4).unpack('N'.freeze)[0]) - transitions << {:at => transition_time} - end - end - - timecnt.times do |i| - localtime_type = check_read(file, 1).unpack('C'.freeze)[0] - transitions[i][:offset] = localtime_type - end - - offsets = [] - - typecnt.times do |i| - gmtoff, isdst, abbrind = check_read(file, 6).unpack('NCC'.freeze) - gmtoff = make_signed_int32(gmtoff) - isdst = isdst == 1 - offset = {:utc_total_offset => gmtoff, :is_dst => isdst, :abbr_index => abbrind} - - unless isdst - offset[:utc_offset] = gmtoff - end - - offsets << offset - end - - abbrev = check_read(file, charcnt) - - if using_64bit - # Skip to the POSIX-style TZ string. - file.seek(ttisstdcnt + ttisutccnt, IO::SEEK_CUR) # + leapcnt * 8, but leapcnt is checked above and guaranteed to be 0. - tz_string_start = check_read(file, 1) - raise InvalidZoneinfoFile, "Expected newline starting POSIX-style TZ string in file '#{file.path}'." unless tz_string_start == "\n" - tz_string = RubyCoreSupport.force_encoding(file.readline("\n"), 'UTF-8') - raise InvalidZoneinfoFile, "Expected newline ending POSIX-style TZ string in file '#{file.path}'." unless tz_string.chomp!("\n") - - begin - rules = posix_tz_parser.parse(tz_string) - rescue InvalidPosixTimeZone => e - raise InvalidZoneinfoFile, "Failed to parse POSIX-style TZ string in file '#{file.path}': #{e}" - end - else - rules = nil - end - - offsets.each do |o| - abbrev_start = o[:abbr_index] - raise InvalidZoneinfoFile, "Abbreviation index is out of range in file '#{file.path}'" unless abbrev_start < abbrev.length - - abbrev_end = abbrev.index("\0", abbrev_start) - raise InvalidZoneinfoFile, "Missing abbreviation null terminator in file '#{file.path}'" unless abbrev_end - - o[:abbr] = RubyCoreSupport.force_encoding(abbrev[abbrev_start...abbrev_end], 'UTF-8') - end - - transitions.each do |t| - if t[:offset] < 0 || t[:offset] >= offsets.length - raise InvalidZoneinfoFile, "Invalid offset referenced by transition in file '#{file.path}'." - end - end - - # Derive the offsets from standard time (std_offset). - first_offset_index = derive_offsets(transitions, offsets) - - # Filter out transitions that are not supported by Time on this - # platform. - unless transitions.empty? - if !RubyCoreSupport.time_supports_negative - transitions = remove_unsupported_negative_transitions(transitions, 0) - elsif !RubyCoreSupport.time_supports_64bit - transitions = remove_unsupported_negative_transitions(transitions, -2**31) - else - # Ignore transitions that occur outside of a defined window. The - # transition index cannot handle a large range of transition times. - # - # This is primarily intended to ignore the far in the past - # transition added in zic 2014c (at timestamp -2**63 in zic 2014c - # and at the approximate time of the big bang from zic 2014d). - # - # Assumes MIN_TIMESTAMP is less than -2**31. - transitions = remove_unsupported_negative_transitions(transitions, MIN_TIMESTAMP) - end - - if !RubyCoreSupport.time_supports_64bit - i = transitions.find_index {|t| t[:at] >= 2**31 } - had_later_transition = !!i - transitions = transitions.first(i) if i - else - had_later_transition = false - end - end - - if rules && !had_later_transition - if transitions.empty? - transitions = apply_rules_without_transitions(file, offsets, first_offset_index, rules) - else - apply_rules_with_transitions(file, transitions, offsets, first_offset_index, rules) - end - end - - define_offset(first_offset_index, offsets[first_offset_index]) - - used_offset_indexes = transitions.map {|t| t[:offset] }.to_set - - offsets.each_with_index do |o, i| - define_offset(i, o) if i != first_offset_index && used_offset_indexes.include?(i) - end - - # Ignore transitions that occur outside of a defined window. The - # transition index cannot handle a large range of transition times. - transitions.each do |t| - at = t[:at] - break if at >= MAX_TIMESTAMP - time = Time.at(at).utc - transition time.year, time.mon, t[:offset], at - end - end - end -end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo.rb new file mode 100644 index 0000000000..df447a9daf --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo.rb @@ -0,0 +1,73 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +# The top level module for TZInfo. +module TZInfo +end + +# Object#untaint is a deprecated no-op in Ruby >= 2.7 and will be removed in +# 3.2. Add a refinement to either silence the warning, or supply the method if +# needed. +if !Object.new.respond_to?(:untaint) || RUBY_VERSION =~ /\A(\d+)\.(\d+)(?:\.|\z)/ && ($1 == '2' && $2.to_i >= 7 || $1.to_i >= 3) + require_relative 'tzinfo/untaint_ext' +end + +require_relative 'tzinfo/version' + +require_relative 'tzinfo/string_deduper' + +require_relative 'tzinfo/timestamp' + +require_relative 'tzinfo/with_offset' +require_relative 'tzinfo/datetime_with_offset' +require_relative 'tzinfo/time_with_offset' +require_relative 'tzinfo/timestamp_with_offset' + +require_relative 'tzinfo/timezone_offset' +require_relative 'tzinfo/timezone_transition' +require_relative 'tzinfo/transition_rule' +require_relative 'tzinfo/annual_rules' + +require_relative 'tzinfo/data_sources' +require_relative 'tzinfo/data_sources/timezone_info' +require_relative 'tzinfo/data_sources/data_timezone_info' +require_relative 'tzinfo/data_sources/linked_timezone_info' +require_relative 'tzinfo/data_sources/constant_offset_data_timezone_info' +require_relative 'tzinfo/data_sources/transitions_data_timezone_info' + +require_relative 'tzinfo/data_sources/country_info' + +require_relative 'tzinfo/data_sources/posix_time_zone_parser' +require_relative 'tzinfo/data_sources/zoneinfo_reader' + +require_relative 'tzinfo/data_source' +require_relative 'tzinfo/data_sources/ruby_data_source' +require_relative 'tzinfo/data_sources/zoneinfo_data_source' + +require_relative 'tzinfo/timezone_period' +require_relative 'tzinfo/offset_timezone_period' +require_relative 'tzinfo/transitions_timezone_period' +require_relative 'tzinfo/timezone' +require_relative 'tzinfo/info_timezone' +require_relative 'tzinfo/data_timezone' +require_relative 'tzinfo/linked_timezone' +require_relative 'tzinfo/timezone_proxy' + +require_relative 'tzinfo/country' +require_relative 'tzinfo/country_timezone' + +require_relative 'tzinfo/format2' +require_relative 'tzinfo/format2/country_definer' +require_relative 'tzinfo/format2/country_index_definer' +require_relative 'tzinfo/format2/country_index_definition' +require_relative 'tzinfo/format2/timezone_definer' +require_relative 'tzinfo/format2/timezone_definition' +require_relative 'tzinfo/format2/timezone_index_definer' +require_relative 'tzinfo/format2/timezone_index_definition' + +require_relative 'tzinfo/format1' +require_relative 'tzinfo/format1/country_definer' +require_relative 'tzinfo/format1/country_index_definition' +require_relative 'tzinfo/format1/timezone_definer' +require_relative 'tzinfo/format1/timezone_definition' +require_relative 'tzinfo/format1/timezone_index_definition' diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/annual_rules.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/annual_rules.rb new file mode 100644 index 0000000000..c73e38b6a8 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/annual_rules.rb @@ -0,0 +1,71 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + # A set of rules that define when transitions occur in time zones with + # annually occurring daylight savings time. + # + # @private + class AnnualRules #:nodoc: + # @return [TimezoneOffset] the standard offset that applies when daylight + # savings time is not in force. + attr_reader :std_offset + + # @return [TimezoneOffset] the offset that applies when daylight savings + # time is in force. + attr_reader :dst_offset + + # @return [TransitionRule] the rule that determines when daylight savings + # time starts. + attr_reader :dst_start_rule + + # @return [TransitionRule] the rule that determines when daylight savings + # time ends. + attr_reader :dst_end_rule + + # Initializes a new {AnnualRules} instance. + # + # @param std_offset [TimezoneOffset] the standard offset that applies when + # daylight savings time is not in force. + # @param dst_offset [TimezoneOffset] the offset that applies when daylight + # savings time is in force. + # @param dst_start_rule [TransitionRule] the rule that determines when + # daylight savings time starts. + # @param dst_end_rule [TransitionRule] the rule that determines when daylight + # savings time ends. + def initialize(std_offset, dst_offset, dst_start_rule, dst_end_rule) + @std_offset = std_offset + @dst_offset = dst_offset + @dst_start_rule = dst_start_rule + @dst_end_rule = dst_end_rule + end + + # Returns the transitions between standard and daylight savings time for a + # given year. The results are ordered by time of occurrence (earliest to + # latest). + # + # @param year [Integer] the year to calculate transitions for. + # @return [Array] the transitions for the year. + def transitions(year) + start_dst = apply_rule(@dst_start_rule, @std_offset, @dst_offset, year) + end_dst = apply_rule(@dst_end_rule, @dst_offset, @std_offset, year) + + end_dst.timestamp_value < start_dst.timestamp_value ? [end_dst, start_dst] : [start_dst, end_dst] + end + + private + + # Applies a given rule between offsets on a year. + # + # @param rule [TransitionRule] the rule to apply. + # @param from_offset [TimezoneOffset] the offset the rule transitions from. + # @param to_offset [TimezoneOffset] the offset the rule transitions to. + # @param year [Integer] the year when the transition occurs. + # @return [TimezoneTransition] the transition determined by the rule. + def apply_rule(rule, from_offset, to_offset, year) + at = rule.at(from_offset, year) + TimezoneTransition.new(to_offset, from_offset, at.value) + end + end + private_constant :AnnualRules +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/country.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/country.rb new file mode 100644 index 0000000000..1bd216afd4 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/country.rb @@ -0,0 +1,208 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + # {InvalidCountryCode} is raised by {Country#get} if the code given is not a + # valid ISO 3166-1 alpha-2 code. + class InvalidCountryCode < StandardError + end + + # The {Country} class represents an ISO 3166-1 country. It can be used to + # obtain a list of time zones observed by a country. For example: + # + # united_states = Country.get('US') + # united_states.zone_identifiers + # united_states.zones + # united_states.zone_info + # + # The {Country} class is thread-safe. It is safe to use class and instance + # methods of {Country} in concurrently executing threads. Instances of + # {Country} can be shared across thread boundaries. + # + # Country information available through TZInfo is intended as an aid for + # users, to help them select time zone data appropriate for their practical + # needs. It is not intended to take or endorse any position on legal or + # territorial claims. + class Country + include Comparable + + class << self + # Gets a {Country} by its ISO 3166-1 alpha-2 code. + # + # The {Country.all_codes} method can be used to obtain a list of valid ISO + # 3166-1 alpha-2 codes. + # + # @param code [String] An ISO 3166-1 alpha-2 code. + # @return [Country] a {Country} instance representing the ISO-3166-1 + # country identified by the `code` parameter. + # @raise [InvalidCountryCode] If {code} is not a valid ISO 3166-1 alpha-2 + # code it couldn't be found. + def get(code) + Country.new(data_source.get_country_info(code)) + end + + # @return [Array] an `Array` containing all the valid ISO 3166-1 + # alpha-2 country codes. + def all_codes + data_source.country_codes + end + + # @return [Array] an `Array` containing one {Country} instance + # for each defined country. + def all + data_source.country_codes.collect {|code| get(code)} + end + + private + + # @return [DataSource] the current DataSource. + def data_source + DataSource.get + end + end + + # Initializes a new {Country} based upon a {DataSources::CountryInfo} + # instance. + # + # {Country} instances should not normally be constructed directly. Use + # the {Country.get} method to obtain instances instead. + # + # @param info [DataSources::CountryInfo] the data to base the new {Country} + # instance upon. + def initialize(info) + @info = info + end + + # @return [String] the ISO 3166-1 alpha-2 country code. + def code + @info.code + end + + # @return [String] the name of the country. + def name + @info.name + end + + # @return [String] a `String` representation of this {Country} (the name of + # the country). + def to_s + name + end + + # @return [String] the internal object state as a programmer-readable + # `String`. + def inspect + "#<#{self.class}: #{@info.code}>" + end + + # Returns an `Array` containing the identifier for each time zone observed + # by the country. These are in an order that + # + # 1. makes some geographical sense, and + # 2. puts the most populous zones first, where that does not contradict 1. + # + # Returned zone identifiers may refer to cities and regions outside of the + # country. This will occur if the zone covers multiple countries. Any zones + # referring to a city or region in a different country will be listed after + # those relating to this country. + # + # @return [Array] an `Array` containing the identifier for each time + # zone observed by the country + def zone_identifiers + zone_info.map(&:identifier) + end + alias zone_names zone_identifiers + + # Returns An `Array` containing a {Timezone} instance for each time zone + # observed by the country. These are in an order that + # + # 1. makes some geographical sense, and + # 2. puts the most populous zones first, where that does not contradict 1. + # + # The identifiers of the time zones returned may refer to cities and regions + # outside of the country. This will occur if the time zone covers multiple + # countries. Any zones referring to a city or region in a different country + # will be listed after those relating to this country. + # + # The results are actually instances of {TimezoneProxy} in order to defer + # loading of the time zone transition data until it is first needed. + # + # @return [Array] an `Array` containing a {Timezone} instance for + # each time zone observed by the country. + def zones + zone_info.map(&:timezone) + end + + # Returns a frozen `Array` containing a {CountryTimezone} instance for each + # time zone observed by the country. These are in an order that + # + # 1. makes some geographical sense, and + # 2. puts the most populous zones first, where that does not contradict 1. + # + # The {CountryTimezone} instances can be used to obtain the location and + # descriptions of the observed time zones. + # + # Identifiers and descriptions of the time zones returned may refer to + # cities and regions outside of the country. This will occur if the time + # zone covers multiple countries. Any zones referring to a city or region in + # a different country will be listed after those relating to this country. + # + # @return [Array] a frozen `Array` containing a + # {CountryTimezone} instance for each time zone observed by the country. + def zone_info + @info.zones + end + + # Compares this {Country} with another based on their {code}. + # + # @param c [Object] an `Object` to compare this {Country} with. + # @return [Integer] -1 if `c` is less than `self`, 0 if `c` is equal to + # `self` and +1 if `c` is greater than `self`, or `nil` if `c` is not an + # instance of {Country}. + def <=>(c) + return nil unless c.is_a?(Country) + code <=> c.code + end + + # @param c [Object] an `Object` to compare this {Country} with. + # @return [Boolean] `true` if `c` is an instance of {Country} and has the + # same code as `self`, otherwise `false`. + def eql?(c) + self == c + end + + # @return [Integer] a hash based on the {code}. + def hash + code.hash + end + + # Matches `regexp` against the {code} of this {Country}. + # + # @param regexp [Regexp] a `Regexp` to match against the {code} of + # this {Country}. + # @return [Integer] the position the match starts, or `nil` if there is no + # match. + def =~(regexp) + regexp =~ code + end + + # Returns a serialized representation of this {Country}. This method is + # called when using `Marshal.dump` with an instance of {Country}. + # + # @param limit [Integer] the maximum depth to dump - ignored. + # @return [String] a serialized representation of this {Country}. + def _dump(limit) + code + end + + # Loads a {Country} from the serialized representation returned by {_dump}. + # This is method is called when using `Marshal.load` or `Marshal.restore` + # to restore a serialized {Country}. + # + # @param data [String] a serialized representation of a {Country}. + # @return [Country] the result of converting `data` back into a {Country}. + def self._load(data) + Country.get(data) + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/country_timezone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/country_timezone.rb new file mode 100644 index 0000000000..0def7fe1e8 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/country_timezone.rb @@ -0,0 +1,93 @@ +# encoding: UTF-8 + +module TZInfo + # Information about a time zone used by a {Country}. + class CountryTimezone + # @return [String] the identifier of the {Timezone} being described. + attr_reader :identifier + + # The latitude of this time zone in degrees. Positive numbers are degrees + # north and negative numbers are degrees south. + # + # Note that depending on the data source, the position given by {#latitude} + # and {#longitude} may not be within the country. + # + # @return [Rational] the latitude in degrees. + attr_reader :latitude + + # The longitude of this time zone in degrees. Positive numbers are degrees + # east and negative numbers are degrees west. + # + # Note that depending on the data source, the position given by {#latitude} + # and {#longitude} may not be within the country. + # + # @return [Rational] the longitude in degrees. + attr_reader :longitude + + # A description of this time zone in relation to the country, e.g. "Eastern + # Time". This is usually `nil` for countries that have a single time zone. + # + # @return [String] an optional description of the time zone. + attr_reader :description + + # Creates a new {CountryTimezone}. + # + # The passed in identifier and description instances will be frozen. + # + # {CountryTimezone} instances should normally only be constructed + # by implementations of {DataSource}. + # + # @param identifier [String] the {Timezone} identifier. + # @param latitude [Rational] the latitude of the time zone. + # @param longitude [Rational] the longitude of the time zone. + # @param description [String] an optional description of the time zone. + def initialize(identifier, latitude, longitude, description = nil) + @identifier = identifier.freeze + @latitude = latitude + @longitude = longitude + @description = description && description.freeze + end + + # Returns the associated {Timezone}. + # + # The result is actually an instance of {TimezoneProxy} in order to defer + # loading of the time zone transition data until it is first needed. + # + # @return [Timezone] the associated {Timezone}. + def timezone + Timezone.get_proxy(@identifier) + end + + # @return [String] the {description} if present, otherwise a human-readable + # representation of the identifier (using {Timezone#friendly_identifier}). + def description_or_friendly_identifier + description || timezone.friendly_identifier(true) + end + + # Tests if the given object is equal to the current instance (has the same + # identifier, latitude, longitude and description). + # + # @param ct [Object] the object to be compared. + # @return [TrueClass] `true` if `ct` is equal to the current instance. + def ==(ct) + ct.kind_of?(CountryTimezone) && + identifier == ct.identifier && latitude == ct.latitude && + longitude == ct.longitude && description == ct.description + end + + # Tests if the given object is equal to the current instance (has the same + # identifier, latitude, longitude and description). + # + # @param ct [Object] the object to be compared. + # @return [Boolean] `true` if `ct` is equal to the current instance. + def eql?(ct) + self == ct + end + + # @return [Integer] a hash based on the {identifier}, {latitude}, + # {longitude} and {description}. + def hash + [@identifier, @latitude, @longitude, @description].hash + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_source.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_source.rb new file mode 100644 index 0000000000..6288aec221 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_source.rb @@ -0,0 +1,435 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +require 'concurrent' +require 'thread' + +module TZInfo + # {InvalidDataSource} is raised if the selected {DataSource} doesn't implement + # one of the required methods. + class InvalidDataSource < StandardError + end + + # {DataSourceNotFound} is raised if no data source could be found (i.e. if + # `'tzinfo/data'` cannot be found on the load path and no valid zoneinfo + # directory can be found on the system). + class DataSourceNotFound < StandardError + end + + # TZInfo can be used with different data sources for time zone and country + # data. Each source of data is implemented as a subclass of {DataSource}. + # + # To choose a data source and override the default selection, use the + # {DataSource.set} method. + # + # @abstract To create a custom data source, create a subclass of {DataSource} + # and implement the {load_timezone_info}, {data_timezone_identifiers}, + # {linked_timezone_identifiers}, {load_country_info} and {country_codes} + # methods. + class DataSource + # The currently selected data source. + # + # @private + @@instance = nil + + # A `Mutex` used to ensure the default data source is only created once. + # + # @private + @@default_mutex = Mutex.new + + class << self + # @return [DataSource] the currently selected source of data. + def get + # If a DataSource hasn't been manually set when the first request is + # made to obtain a DataSource, then a default data source is created. + # + # This is done at the first request rather than when TZInfo is loaded to + # avoid unnecessary attempts to find a suitable DataSource. + # + # A `Mutex` is used to ensure that only a single default instance is + # created (this avoiding the possibility of retaining two copies of the + # same data in memory). + + unless @@instance + @@default_mutex.synchronize do + set(create_default_data_source) unless @@instance + end + end + + @@instance + end + + # Sets the currently selected data source for time zone and country data. + # + # This should usually be set to one of the two standard data source types: + # + # * `:ruby` - read data from the Ruby modules included in the TZInfo::Data + # library (tzinfo-data gem). + # * `:zoneinfo` - read data from the zoneinfo files included with most + # Unix-like operating systems (e.g. in /usr/share/zoneinfo). + # + # To set TZInfo to use one of the standard data source types, call + # `TZInfo::DataSource.set`` in one of the following ways: + # + # TZInfo::DataSource.set(:ruby) + # TZInfo::DataSource.set(:zoneinfo) + # TZInfo::DataSource.set(:zoneinfo, zoneinfo_dir) + # TZInfo::DataSource.set(:zoneinfo, zoneinfo_dir, iso3166_tab_file) + # + # `DataSource.set(:zoneinfo)` will automatically search for the zoneinfo + # directory by checking the paths specified in + # {DataSources::ZoneinfoDataSource.search_path}. + # {DataSources::ZoneinfoDirectoryNotFound} will be raised if no valid + # zoneinfo directory could be found. + # + # `DataSource.set(:zoneinfo, zoneinfo_dir)` uses the specified + # `zoneinfo_dir` directory as the data source. If the directory is not a + # valid zoneinfo directory, a {DataSources::InvalidZoneinfoDirectory} + # exception will be raised. + # + # `DataSource.set(:zoneinfo, zoneinfo_dir, iso3166_tab_file)` uses the + # specified `zoneinfo_dir` directory as the data source, but loads the + # `iso3166.tab` file from the path given by `iso3166_tab_file`. If the + # directory is not a valid zoneinfo directory, a + # {DataSources::InvalidZoneinfoDirectory} exception will be raised. + # + # Custom data sources can be created by subclassing TZInfo::DataSource and + # implementing the following methods: + # + # * {load_timezone_info} + # * {data_timezone_identifiers} + # * {linked_timezone_identifiers} + # * {load_country_info} + # * {country_codes} + # + # To have TZInfo use the custom data source, call {DataSource.set}, + # passing an instance of the custom data source implementation as follows: + # + # TZInfo::DataSource.set(CustomDataSource.new) + # + # Calling {DataSource.set} will only affect instances of {Timezone} and + # {Country} obtained with {Timezone.get} and {Country.get} subsequent to + # the {DataSource.set} call. Existing {Timezone} and {Country} instances + # will be unaffected. + # + # If {DataSource.set} is not called, TZInfo will by default attempt to use + # TZInfo::Data as the data source. If TZInfo::Data is not available (i.e. + # if `require 'tzinfo/data'` fails), then TZInfo will search for a + # zoneinfo directory instead (using the search path specified by + # {DataSources::ZoneinfoDataSource.search_path}). + # + # @param data_source_or_type [Object] either `:ruby`, `:zoneinfo` or an + # instance of a {DataSource}. + # @param args [Array] when `data_source_or_type` is a symbol, + # optional arguments to use when initializing the data source. + # @raise [ArgumentError] if `data_source_or_type` is not `:ruby`, + # `:zoneinfo` or an instance of {DataSource}. + def set(data_source_or_type, *args) + if data_source_or_type.kind_of?(DataSource) + @@instance = data_source_or_type + elsif data_source_or_type == :ruby + @@instance = DataSources::RubyDataSource.new + elsif data_source_or_type == :zoneinfo + @@instance = DataSources::ZoneinfoDataSource.new(*args) + else + raise ArgumentError, 'data_source_or_type must be a DataSource instance or a data source type (:ruby or :zoneinfo)' + end + end + + private + + # Creates a {DataSource} instance for use as the default. Used if no + # preference has been specified manually. + # + # @return [DataSource] the newly created default {DataSource} instance. + def create_default_data_source + has_tzinfo_data = false + + begin + require 'tzinfo/data' + has_tzinfo_data = true + rescue LoadError + end + + return DataSources::RubyDataSource.new if has_tzinfo_data + + begin + return DataSources::ZoneinfoDataSource.new + rescue DataSources::ZoneinfoDirectoryNotFound + raise DataSourceNotFound, "No source of timezone data could be found.\nPlease refer to https://tzinfo.github.io/datasourcenotfound for help resolving this error." + end + end + end + + # Initializes a new {DataSource} instance. Typically only called via + # subclasses of {DataSource}. + def initialize + @timezones = Concurrent::Map.new + end + + # Returns a {DataSources::TimezoneInfo} instance for the given identifier. + # The result will derive from either {DataSources::DataTimezoneInfo} for + # time zones that define their own data or {DataSources::LinkedTimezoneInfo} + # for links or aliases to other time zones. + # + # {get_timezone_info} calls {load_timezone_info} to create the + # {DataSources::TimezoneInfo} instance. The returned instance is cached and + # returned in subsequent calls to {get_timezone_info} for the identifier. + # + # @param identifier [String] A time zone identifier. + # @return [DataSources::TimezoneInfo] a {DataSources::TimezoneInfo} instance + # for a given identifier. + # @raise [InvalidTimezoneIdentifier] if the time zone is not found or the + # identifier is invalid. + def get_timezone_info(identifier) + result = @timezones[identifier] + + unless result + # Thread-safety: It is possible that multiple equivalent TimezoneInfo + # instances could be created here in concurrently executing threads. The + # consequences of this are that the data may be loaded more than once + # (depending on the data source). The performance benefit of ensuring + # that only a single instance is created is unlikely to be worth the + # overhead of only allowing one TimezoneInfo to be loaded at a time. + + result = load_timezone_info(identifier) + @timezones[result.identifier] = result + end + + result + end + + # @return [Array] a frozen `Array`` of all the available time zone + # identifiers. The identifiers are sorted according to `String#<=>`. + def timezone_identifiers + # Thread-safety: It is possible that the value of @timezone_identifiers + # may be calculated multiple times in concurrently executing threads. It + # is not worth the overhead of locking to ensure that + # @timezone_identifiers is only calculated once. + @timezone_identifiers ||= build_timezone_identifiers + end + + # Returns a frozen `Array` of all the available time zone identifiers for + # data time zones (i.e. those that actually contain definitions). The + # identifiers are sorted according to `String#<=>`. + # + # @return [Array] a frozen `Array` of all the available time zone + # identifiers for data time zones. + def data_timezone_identifiers + raise_invalid_data_source('data_timezone_identifiers') + end + + # Returns a frozen `Array` of all the available time zone identifiers that + # are links to other time zones. The identifiers are sorted according to + # `String#<=>`. + # + # @return [Array] a frozen `Array` of all the available time zone + # identifiers that are links to other time zones. + def linked_timezone_identifiers + raise_invalid_data_source('linked_timezone_identifiers') + end + + # @param code [String] an ISO 3166-1 alpha-2 country code. + # @return [DataSources::CountryInfo] a {DataSources::CountryInfo} instance + # for the given ISO 3166-1 alpha-2 country code. + # @raise [InvalidCountryCode] if the country could not be found or the code + # is invalid. + def get_country_info(code) + load_country_info(code) + end + + # Returns a frozen `Array` of all the available ISO 3166-1 alpha-2 country + # codes. The identifiers are sorted according to `String#<=>`. + # + # @return [Array] a frozen `Array` of all the available ISO 3166-1 + # alpha-2 country codes. + def country_codes + raise_invalid_data_source('country_codes') + end + + # @return [String] a description of the {DataSource}. + def to_s + "Default DataSource" + end + + # @return [String] the internal object state as a programmer-readable + # `String`. + def inspect + "#<#{self.class}>" + end + + protected + + # Returns a {DataSources::TimezoneInfo} instance for the given time zone + # identifier. The result should derive from either + # {DataSources::DataTimezoneInfo} for time zones that define their own data + # or {DataSources::LinkedTimezoneInfo} for links to or aliases for other + # time zones. + # + # @param identifier [String] A time zone identifier. + # @return [DataSources::TimezoneInfo] a {DataSources::TimezoneInfo} instance + # for the given time zone identifier. + # @raise [InvalidTimezoneIdentifier] if the time zone is not found or the + # identifier is invalid. + def load_timezone_info(identifier) + raise_invalid_data_source('load_timezone_info') + end + + # @param code [String] an ISO 3166-1 alpha-2 country code. + # @return [DataSources::CountryInfo] a {DataSources::CountryInfo} instance + # for the given ISO 3166-1 alpha-2 country code. + # @raise [InvalidCountryCode] if the country could not be found or the code + # is invalid. + def load_country_info(code) + raise_invalid_data_source('load_country_info') + end + + # @return [Encoding] the `Encoding` used by the `String` instances returned + # by {data_timezone_identifiers} and {linked_timezone_identifiers}. + def timezone_identifier_encoding + Encoding::UTF_8 + end + + # Checks that the given identifier is a valid time zone identifier (can be + # found in the {timezone_identifiers} `Array`). If the identifier is valid, + # the `String` instance representing that identifier from + # `timezone_identifiers` is returned. Otherwise an + # {InvalidTimezoneIdentifier} exception is raised. + # + # @param identifier [String] a time zone identifier to be validated. + # @return [String] the `String` instance equivalent to `identifier` from + # {timezone_identifiers}. + # @raise [InvalidTimezoneIdentifier] if `identifier` was not found in + # {timezone_identifiers}. + def validate_timezone_identifier(identifier) + raise InvalidTimezoneIdentifier, "Invalid identifier: #{identifier.nil? ? 'nil' : identifier}" unless identifier.kind_of?(String) + + valid_identifier = try_with_encoding(identifier, timezone_identifier_encoding) {|id| find_timezone_identifier(id) } + return valid_identifier if valid_identifier + + raise InvalidTimezoneIdentifier, "Invalid identifier: #{identifier.encode(Encoding::UTF_8)}" + end + + # Looks up a given code in the given hash of code to + # {DataSources::CountryInfo} mappings. If the code is found the + # {DataSources::CountryInfo} is returned. Otherwise an {InvalidCountryCode} + # exception is raised. + # + # @param hash [String, DataSources::CountryInfo] a mapping from ISO 3166-1 + # alpha-2 country codes to {DataSources::CountryInfo} instances. + # @param code [String] a country code to lookup. + # @param encoding [Encoding] the encoding used for the country codes in + # `hash`. + # @return [DataSources::CountryInfo] the {DataSources::CountryInfo} instance + # corresponding to `code`. + # @raise [InvalidCountryCode] if `code` was not found in `hash`. + def lookup_country_info(hash, code, encoding = Encoding::UTF_8) + raise InvalidCountryCode, "Invalid country code: #{code.nil? ? 'nil' : code}" unless code.kind_of?(String) + + info = try_with_encoding(code, encoding) {|c| hash[c] } + return info if info + + raise InvalidCountryCode, "Invalid country code: #{code.encode(Encoding::UTF_8)}" + end + + private + + # Raises {InvalidDataSource} to indicate that a method has not been + # overridden by a particular data source implementation. + # + # @raise [InvalidDataSource] always. + def raise_invalid_data_source(method_name) + raise InvalidDataSource, "#{method_name} not defined" + end + + # Combines {data_timezone_identifiers} and {linked_timezone_identifiers} + # to create an `Array` containing all valid time zone identifiers. If + # {linked_timezone_identifiers} is empty, the {data_timezone_identifiers} + # instance is returned. + # + # The returned `Array` is frozen. The identifiers are sorted according to + # `String#<=>`. + # + # @return [Array] an `Array` containing all valid time zone + # identifiers. + def build_timezone_identifiers + data = data_timezone_identifiers + linked = linked_timezone_identifiers + linked.empty? ? data : (data + linked).sort!.freeze + end + + if [].respond_to?(:bsearch) + # If the given `identifier` is contained within the {timezone_identifiers} + # `Array`, the `String` instance representing that identifier from + # {timezone_identifiers} is returned. Otherwise, `nil` is returned. + # + # @param identifier [String] A time zone identifier to search for. + # @return [String] the `String` instance representing `identifier` from + # {timezone_identifiers} if found, or `nil` if not found. + # + # :nocov_no_array_bsearch: + def find_timezone_identifier(identifier) + + result = timezone_identifiers.bsearch {|i| i >= identifier } + result == identifier ? result : nil + end + # :nocov_no_array_bsearch: + else + # If the given `identifier` is contained within the {timezone_identifiers} + # `Array`, the `String` instance representing that identifier from + # {timezone_identifiers} is returned. Otherwise, `nil` is returned. + # + # @param identifier [String] A time zone identifier to search for. + # @return [String] the `String` instance representing `identifier` from + # {timezone_identifiers} if found, or `nil` if not found. + # + # :nocov_array_bsearch: + def find_timezone_identifier(identifier) + identifiers = timezone_identifiers + low = 0 + high = identifiers.length + + while low < high do + mid = (low + high).div(2) + mid_identifier = identifiers[mid] + cmp = mid_identifier <=> identifier + + return mid_identifier if cmp == 0 + + if cmp > 0 + high = mid + else + low = mid + 1 + end + end + + nil + end + # :nocov_array_bsearch: + end + + # Tries an operation using `string` directly. If the operation fails, the + # string is copied and encoded with `encoding` and the operation is tried + # again. + # + # @param string [String] The `String` to perform the operation on. + # @param encoding [Encoding] The `Encoding` to use if the initial attempt + # fails. + # @yield [s] the caller will be yielded to once or twice to attempt the + # operation. + # @yieldparam s [String] either `string` or an encoded copy of `string`. + # @yieldreturn [Object] The result of the operation. Must be truthy if + # successful. + # @return [Object] the result of the operation or `nil` if the first attempt + # fails and `string` is already encoded with `encoding`. + def try_with_encoding(string, encoding) + result = yield string + return result if result + + unless encoding == string.encoding + string = string.encode(encoding) + yield string + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources.rb new file mode 100644 index 0000000000..712920da6e --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources.rb @@ -0,0 +1,8 @@ +# encoding: UTF-8 + +module TZInfo + # {DataSource} implementations and classes used by {DataSource} + # implementations. + module DataSources + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/constant_offset_data_timezone_info.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/constant_offset_data_timezone_info.rb new file mode 100644 index 0000000000..076ee9bfe4 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/constant_offset_data_timezone_info.rb @@ -0,0 +1,56 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + module DataSources + # Represents a data time zone defined by a constantly observed offset. + class ConstantOffsetDataTimezoneInfo < DataTimezoneInfo + # @return [TimezoneOffset] the offset that is constantly observed. + attr_reader :constant_offset + + # Initializes a new {ConstantOffsetDataTimezoneInfo}. + # + # The passed in `identifier` instance will be frozen. A reference to the + # passed in {TimezoneOffset} will be retained. + # + # @param identifier [String] the identifier of the time zone. + # @param constant_offset [TimezoneOffset] the constantly observed offset. + # @raise [ArgumentError] if `identifier` or `constant_offset` is `nil`. + def initialize(identifier, constant_offset) + super(identifier) + raise ArgumentError, 'constant_offset must be specified' unless constant_offset + @constant_offset = constant_offset + end + + # @param timestamp [Timestamp] ignored. + # @return [TimezonePeriod] an unbounded {TimezonePeriod} for the time + # zone's constantly observed offset. + def period_for(timestamp) + constant_period + end + + # @param local_timestamp [Timestamp] ignored. + # @return [Array] an `Array` containing a single unbounded + # {TimezonePeriod} for the time zone's constantly observed offset. + def periods_for_local(local_timestamp) + [constant_period] + end + + # @param to_timestamp [Timestamp] ignored. + # @param from_timestamp [Timestamp] ignored. + # @return [Array] an empty `Array`, since there are no transitions in time + # zones that observe a constant offset. + def transitions_up_to(to_timestamp, from_timestamp = nil) + [] + end + + private + + # @return [TimezonePeriod] an unbounded {TimezonePeriod} with the constant + # offset of this timezone. + def constant_period + OffsetTimezonePeriod.new(@constant_offset) + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/country_info.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/country_info.rb new file mode 100644 index 0000000000..4745f3bed1 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/country_info.rb @@ -0,0 +1,42 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + module DataSources + # Represents a country and references to its time zones as returned by a + # {DataSource}. + class CountryInfo + # @return [String] the ISO 3166-1 alpha-2 country code. + attr_reader :code + + # @return [String] the name of the country. + attr_reader :name + + # @return [Array] the time zones observed in the country. + attr_reader :zones + + # Initializes a new {CountryInfo}. The passed in `code`, `name` and + # `zones` instances will be frozen. + # + # @param code [String] an ISO 3166-1 alpha-2 country code. + # @param name [String] the name of the country. + # @param zones [Array] the time zones observed in the + # country. + # @raise [ArgumentError] if `code`, `name` or `zones` is `nil`. + def initialize(code, name, zones) + raise ArgumentError, 'code must be specified' unless code + raise ArgumentError, 'name must be specified' unless name + raise ArgumentError, 'zones must be specified' unless zones + @code = code.freeze + @name = name.freeze + @zones = zones.freeze + end + + # @return [String] the internal object state as a programmer-readable + # `String`. + def inspect + "#<#{self.class}: #@code>" + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/data_timezone_info.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/data_timezone_info.rb new file mode 100644 index 0000000000..d43203a1a2 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/data_timezone_info.rb @@ -0,0 +1,91 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + module DataSources + # The base class for time zones defined as either a series of transitions + # ({TransitionsDataTimezoneInfo}) or a constantly observed offset + # ({ConstantOffsetDataTimezoneInfo}). + # + # @abstract Data sources return instances of {DataTimezoneInfo} subclasses. + class DataTimezoneInfo < TimezoneInfo + # @param timestamp [Timestamp] a {Timestamp} with a specified + # {Timestamp#utc_offset utc_offset}. + # @return [TimezonePeriod] the {TimezonePeriod} observed at the time + # specified by `timestamp`. + # @raise [ArgumentError] may be raised if `timestamp` is `nil` or does not + # have a specified {Timestamp#utc_offset utc_offset}. + def period_for(timestamp) + raise_not_implemented('period_for') + end + + # Returns an `Array` containing the {TimezonePeriod TimezonePeriods} that + # could be observed at the local time specified by `local_timestamp`. The + # results are are ordered by increasing UTC start date. An empty `Array` + # is returned if no periods are found for the given local time. + # + # @param local_timestamp [Timestamp] a {Timestamp} representing a local + # time - must have an unspecified {Timestamp#utc_offset utc_offset}. + # @return [Array] an `Array` containing the + # {TimezonePeriod TimezonePeriods} that could be observed at the local + # time specified by `local_timestamp`. + # @raise [ArgumentError] may be raised if `local_timestamp` is `nil`, or + # has a specified {Timestamp#utc_offset utc_offset}. + def periods_for_local(local_timestamp) + raise_not_implemented('periods_for_local') + end + + # Returns an `Array` of {TimezoneTransition} instances representing the + # times where the UTC offset of the time zone changes. + # + # Transitions are returned up to a given {Timestamp} (`to_timestamp`). + # + # A from {Timestamp} may also be supplied using the `from_timestamp` + # parameter. If `from_timestamp` is specified, only transitions from that + # time onwards will be returned. + # + # Comparisons with `to_timestamp` are exclusive. Comparisons with + # `from_timestamp` are inclusive. If a transition falls precisely on + # `to_timestamp`, it will be excluded. If a transition falls on + # `from_timestamp`, it will be included. + # + # Transitions returned are ordered by when they occur, from earliest to + # latest. + # + # @param to_timestamp [Timestamp] a {Timestamp} with a specified + # {Timestamp#utc_offset utc_offset}. Transitions are returned if they + # occur before this time. + # @param from_timestamp [Timestamp] an optional {Timestamp} with a + # specified {Timestamp#utc_offset utc_offset}. If specified, transitions + # are returned if they occur at or after this time. + # @return [Array] an `Array` of {TimezoneTransition} + # instances representing the times where the UTC offset of the time zone + # changes. + # @raise [ArgumentError] may be raised if `to_timestamp` is `nil` or does + # not have a specified {Timestamp#utc_offset utc_offset}. + # @raise [ArgumentError] may be raised if `from_timestamp` is specified + # but does not have a specified {Timestamp#utc_offset utc_offset}. + # @raise [ArgumentError] may be raised if `from_timestamp` is specified + # but is not earlier than or at the same time as `to_timestamp`. + def transitions_up_to(to_timestamp, from_timestamp = nil) + raise_not_implemented('transitions_up_to') + end + + # @return [DataTimezone] a new {DataTimezone} instance for the time zone + # represented by this {DataTimezoneInfo}. + def create_timezone + DataTimezone.new(self) + end + + private + + # Raises a {NotImplementedError} to indicate that the base class is + # incorrectly being used directly. + # + # raise [NotImplementedError] always. + def raise_not_implemented(method_name) + raise NotImplementedError, "Subclasses must override #{method_name}" + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/linked_timezone_info.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/linked_timezone_info.rb new file mode 100644 index 0000000000..f44e79d424 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/linked_timezone_info.rb @@ -0,0 +1,33 @@ +# encoding: UTF-8 + +module TZInfo + module DataSources + # Represents a time zone that is defined as a link to or alias of another + # zone. + class LinkedTimezoneInfo < TimezoneInfo + # @return [String] the identifier of the time zone that provides the data + # (that this zone links to or is an alias for). + attr_reader :link_to_identifier + + # Initializes a new {LinkedTimezoneInfo}. The passed in `identifier` and + # `link_to_identifier` instances will be frozen. + # + # @param identifier [String] the identifier of the time zone. + # @param link_to_identifier [String] the identifier of the time zone that + # this zone link to. + # @raise [ArgumentError] if `identifier` or `link_to_identifier` are + # `nil`. + def initialize(identifier, link_to_identifier) + super(identifier) + raise ArgumentError, 'link_to_identifier must be specified' unless link_to_identifier + @link_to_identifier = link_to_identifier.freeze + end + + # @return [LinkedTimezone] a new {LinkedTimezone} instance for the time + # zone represented by this {LinkedTimezoneInfo}. + def create_timezone + LinkedTimezone.new(self) + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/posix_time_zone_parser.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/posix_time_zone_parser.rb new file mode 100644 index 0000000000..b3d2b2e361 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/posix_time_zone_parser.rb @@ -0,0 +1,181 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +require 'strscan' + +module TZInfo + # Use send as a workaround for erroneous 'wrong number of arguments' errors + # with JRuby 9.0.5.0 when calling methods with Java implementations. See #114. + send(:using, UntaintExt) if TZInfo.const_defined?(:UntaintExt) + + module DataSources + # An {InvalidPosixTimeZone} exception is raised if an invalid POSIX-style + # time zone string is encountered. + # + # @private + class InvalidPosixTimeZone < StandardError #:nodoc: + end + private_constant :InvalidPosixTimeZone + + # A parser for POSIX-style TZ strings used in zoneinfo files and specified + # by tzfile.5 and tzset.3. + # + # @private + class PosixTimeZoneParser #:nodoc: + # Initializes a new {PosixTimeZoneParser}. + # + # @param string_deduper [StringDeduper] a {StringDeduper} instance to use + # to dedupe abbreviations. + def initialize(string_deduper) + @string_deduper = string_deduper + end + + # Parses a POSIX-style TZ string. + # + # @param tz_string [String] the string to parse. + # @return [Object] either a {TimezoneOffset} for a constantly applied + # offset or an {AnnualRules} instance representing the rules. + # @raise [InvalidPosixTimeZone] if `tz_string` is not a `String`. + # @raise [InvalidPosixTimeZone] if `tz_string` is is not valid. + def parse(tz_string) + raise InvalidPosixTimeZone unless tz_string.kind_of?(String) + return nil if tz_string.empty? + + s = StringScanner.new(tz_string) + check_scan(s, /([^-+,\d<][^-+,\d]*) | <([^>]+)>/x) + std_abbrev = @string_deduper.dedupe((s[1] || s[2]).untaint) + check_scan(s, /([-+]?\d+)(?::(\d+)(?::(\d+))?)?/) + std_offset = get_offset_from_hms(s[1], s[2], s[3]) + + if s.scan(/([^-+,\d<][^-+,\d]*) | <([^>]+)>/x) + dst_abbrev = @string_deduper.dedupe((s[1] || s[2]).untaint) + + if s.scan(/([-+]?\d+)(?::(\d+)(?::(\d+))?)?/) + dst_offset = get_offset_from_hms(s[1], s[2], s[3]) + else + # POSIX is negative for ahead of UTC. + dst_offset = std_offset - 3600 + end + + dst_difference = std_offset - dst_offset + + start_rule = parse_rule(s, 'start') + end_rule = parse_rule(s, 'end') + + raise InvalidPosixTimeZone, "Expected the end of a POSIX-style time zone string but found '#{s.rest}'." if s.rest? + + if start_rule.is_always_first_day_of_year? && start_rule.transition_at == 0 && + end_rule.is_always_last_day_of_year? && end_rule.transition_at == 86400 + dst_difference + # Constant daylight savings time. + # POSIX is negative for ahead of UTC. + TimezoneOffset.new(-std_offset, dst_difference, dst_abbrev) + else + AnnualRules.new( + TimezoneOffset.new(-std_offset, 0, std_abbrev), + TimezoneOffset.new(-std_offset, dst_difference, dst_abbrev), + start_rule, + end_rule) + end + elsif !s.rest? + # Constant standard time. + # POSIX is negative for ahead of UTC. + TimezoneOffset.new(-std_offset, 0, std_abbrev) + else + raise InvalidPosixTimeZone, "Expected the end of a POSIX-style time zone string but found '#{s.rest}'." + end + end + + private + + # Parses a rule. + # + # @param s [StringScanner] the `StringScanner` to read the rule from. + # @param type [String] the type of rule (either `'start'` or `'end'`). + # @raise [InvalidPosixTimeZone] if the rule is not valid. + # @return [TransitionRule] the parsed rule. + def parse_rule(s, type) + check_scan(s, /,(?: (?: J(\d+) ) | (\d+) | (?: M(\d+)\.(\d)\.(\d) ) )/x) + julian_day_of_year = s[1] + absolute_day_of_year = s[2] + month = s[3] + week = s[4] + day_of_week = s[5] + + if s.scan(/\//) + check_scan(s, /([-+]?\d+)(?::(\d+)(?::(\d+))?)?/) + transition_at = get_seconds_after_midnight_from_hms(s[1], s[2], s[3]) + else + transition_at = 7200 + end + + begin + if julian_day_of_year + JulianDayOfYearTransitionRule.new(julian_day_of_year.to_i, transition_at) + elsif absolute_day_of_year + AbsoluteDayOfYearTransitionRule.new(absolute_day_of_year.to_i, transition_at) + elsif week == '5' + LastDayOfMonthTransitionRule.new(month.to_i, day_of_week.to_i, transition_at) + else + DayOfMonthTransitionRule.new(month.to_i, week.to_i, day_of_week.to_i, transition_at) + end + rescue ArgumentError => e + raise InvalidPosixTimeZone, "Invalid #{type} rule in POSIX-style time zone string: #{e}" + end + end + + # Returns an offset in seconds from hh:mm:ss values. The value can be + # negative. -02:33:12 would represent 2 hours, 33 minutes and 12 seconds + # ahead of UTC. + # + # @param h [String] the hours. + # @param m [String] the minutes. + # @param s [String] the seconds. + # @return [Integer] the offset. + # @raise [InvalidPosixTimeZone] if the mm and ss values are greater than + # 59. + def get_offset_from_hms(h, m, s) + h = h.to_i + m = m.to_i + s = s.to_i + raise InvalidPosixTimeZone, "Invalid minute #{m} in offset for POSIX-style time zone string." if m > 59 + raise InvalidPosixTimeZone, "Invalid second #{s} in offset for POSIX-style time zone string." if s > 59 + magnitude = (h.abs * 60 + m) * 60 + s + h < 0 ? -magnitude : magnitude + end + + # Returns the seconds from midnight from hh:mm:ss values. Hours can exceed + # 24 for a time on the following day. Hours can be negative to subtract + # hours from midnight on the given day. -02:33:12 represents 22:33:12 on + # the prior day. + # + # @param h [String] the hour. + # @param m [String] the minutes past the hour. + # @param s [String] the seconds past the minute. + # @return [Integer] the number of seconds after midnight. + # @raise [InvalidPosixTimeZone] if the mm and ss values are greater than + # 59. + def get_seconds_after_midnight_from_hms(h, m, s) + h = h.to_i + m = m.to_i + s = s.to_i + raise InvalidPosixTimeZone, "Invalid minute #{m} in time for POSIX-style time zone string." if m > 59 + raise InvalidPosixTimeZone, "Invalid second #{s} in time for POSIX-style time zone string." if s > 59 + (h * 3600) + m * 60 + s + end + + # Scans for a pattern and raises an exception if the pattern does not + # match the input. + # + # @param s [StringScanner] the `StringScanner` to scan. + # @param pattern [Regexp] the pattern to match. + # @return [String] the result of the scan. + # @raise [InvalidPosixTimeZone] if the pattern does not match the input. + def check_scan(s, pattern) + result = s.scan(pattern) + raise InvalidPosixTimeZone, "Expected '#{s.rest}' to match #{pattern} in POSIX-style time zone string." unless result + result + end + end + private_constant :PosixTimeZoneParser + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/ruby_data_source.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/ruby_data_source.rb new file mode 100644 index 0000000000..d2dbb26957 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/ruby_data_source.rb @@ -0,0 +1,145 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + # Use send as a workaround for erroneous 'wrong number of arguments' errors + # with JRuby 9.0.5.0 when calling methods with Java implementations. See #114. + send(:using, UntaintExt) if TZInfo.const_defined?(:UntaintExt) + + module DataSources + # A {TZInfoDataNotFound} exception is raised if the tzinfo-data gem could + # not be found (i.e. `require 'tzinfo/data'` failed) when selecting the Ruby + # data source. + class TZInfoDataNotFound < StandardError + end + + # A DataSource implementation that loads data from the set of Ruby modules + # included in the tzinfo-data gem. + # + # TZInfo will use {RubyDataSource} by default if the tzinfo-data gem + # is available on the load path. It can also be selected by calling + # {DataSource.set} as follows: + # + # TZInfo::DataSource.set(:ruby) + class RubyDataSource < DataSource + # (see DataSource#data_timezone_identifiers) + attr_reader :data_timezone_identifiers + + # (see DataSource#linked_timezone_identifiers) + attr_reader :linked_timezone_identifiers + + # (see DataSource#country_codes) + attr_reader :country_codes + + # Initializes a new {RubyDataSource} instance. + # + # @raise [TZInfoDataNotFound] if the tzinfo-data gem could not be found + # (i.e. `require 'tzinfo/data'` failed). + def initialize + super + + begin + require('tzinfo/data') + rescue LoadError + raise TZInfoDataNotFound, "The tzinfo-data gem could not be found (require 'tzinfo/data' failed)." + end + + if TZInfo::Data.const_defined?(:LOCATION) + # Format 2 + @base_path = File.join(TZInfo::Data::LOCATION, 'tzinfo', 'data') + else + # Format 1 + data_file = File.join('', 'tzinfo', 'data.rb') + path = $".reverse_each.detect {|p| p.end_with?(data_file) } + if path + @base_path = File.join(File.dirname(path), 'data').untaint + else + @base_path = 'tzinfo/data' + end + end + + require_index('timezones') + require_index('countries') + + @data_timezone_identifiers = Data::Indexes::Timezones.data_timezones + @linked_timezone_identifiers = Data::Indexes::Timezones.linked_timezones + @countries = Data::Indexes::Countries.countries + @country_codes = @countries.keys.sort!.freeze + end + + # (see DataSource#to_s) + def to_s + "Ruby DataSource: #{version_info}" + end + + # (see DataSource#inspect) + def inspect + "#" + end + + protected + + # Returns a {TimezoneInfo} instance for the given time zone identifier. + # The result will either be a {ConstantOffsetDataTimezoneInfo}, a + # {TransitionsDataTimezoneInfo} or a {LinkedTimezoneInfo} depending on the + # type of time zone. + # + # @param identifier [String] A time zone identifier. + # @return [TimezoneInfo] a {TimezoneInfo} instance for the given time zone + # identifier. + # @raise [InvalidTimezoneIdentifier] if the time zone is not found or the + # identifier is invalid. + def load_timezone_info(identifier) + valid_identifier = validate_timezone_identifier(identifier) + split_identifier = valid_identifier.gsub(/-/, '__m__').gsub(/\+/, '__p__').split('/') + + begin + require_definition(split_identifier) + + m = Data::Definitions + split_identifier.each {|part| m = m.const_get(part) } + m.get + rescue LoadError, NameError => e + raise InvalidTimezoneIdentifier, "#{e.message.encode(Encoding::UTF_8)} (loading #{valid_identifier})" + end + end + + # (see DataSource#load_country_info) + def load_country_info(code) + lookup_country_info(@countries, code) + end + + private + + # Requires a zone definition by its identifier (split on /). + # + # @param identifier [Array] the component parts of a time zone + # identifier (split on /). This must have already been validated. + def require_definition(identifier) + require_data(*(['definitions'] + identifier)) + end + + # Requires an index by its name. + # + # @param name [String] an index name. + def require_index(name) + require_data(*['indexes', name]) + end + + # Requires a file from tzinfo/data. + # + # @param file [Array] a relative path to a file to be required. + def require_data(*file) + require(File.join(@base_path, *file)) + end + + # @return [String] a `String` containing TZInfo::Data version infomation + # for inclusion in the #to_s and #inspect output. + def version_info + # The TZInfo::Data::VERSION constant is only available from v1.2014.8 + # onwards. + "tzdb v#{TZInfo::Data::Version::TZDATA}#{TZInfo::Data.const_defined?(:VERSION) ? ", tzinfo-data v#{TZInfo::Data::VERSION}" : ''}" + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/timezone_info.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/timezone_info.rb new file mode 100644 index 0000000000..51d8d51acd --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/timezone_info.rb @@ -0,0 +1,47 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + module DataSources + # Represents a time zone defined by a data source. + # + # @abstract Data sources return instances of {TimezoneInfo} subclasses. + class TimezoneInfo + # @return [String] the identifier of the time zone. + attr_reader :identifier + + # Initializes a new TimezoneInfo. The passed in `identifier` instance will + # be frozen. + # + # @param identifier [String] the identifier of the time zone. + # @raise [ArgumentError] if `identifier` is `nil`. + def initialize(identifier) + raise ArgumentError, 'identifier must be specified' unless identifier + @identifier = identifier.freeze + end + + # @return [String] the internal object state as a programmer-readable + # `String`. + def inspect + "#<#{self.class}: #@identifier>" + end + + # @return [Timezone] a new {Timezone} instance for the time zone + # represented by this {TimezoneInfo}. + def create_timezone + raise_not_implemented('create_timezone') + end + + private + + # Raises a {NotImplementedError}. + # + # @param method_name [String] the name of the method that must be + # overridden. + # @raise NotImplementedError always. + def raise_not_implemented(method_name) + raise NotImplementedError, "Subclasses must override #{method_name}" + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/transitions_data_timezone_info.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/transitions_data_timezone_info.rb new file mode 100644 index 0000000000..14fe51e4e9 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/transitions_data_timezone_info.rb @@ -0,0 +1,214 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + module DataSources + # Represents a data time zone defined by a list of transitions that change + # the locally observed time. + class TransitionsDataTimezoneInfo < DataTimezoneInfo + # @return [Array] the transitions that define this + # time zone in order of ascending timestamp. + attr_reader :transitions + + # Initializes a new {TransitionsDataTimezoneInfo}. + # + # The passed in `identifier` instance will be frozen. A reference to the + # passed in `Array` will be retained. + # + # The `transitions` `Array` must be sorted in order of ascending + # timestamp. Each transition must have a + # {TimezoneTransition#timestamp_value timestamp_value} that is greater + # than the {TimezoneTransition#timestamp_value timestamp_value} of the + # prior transition. + # + # @param identifier [String] the identifier of the time zone. + # @param transitions [Array] an `Array` of + # transitions that each indicate when a change occurs in the locally + # observed time. + # @raise [ArgumentError] if `identifier` is `nil`. + # @raise [ArgumentError] if `transitions` is `nil`. + # @raise [ArgumentError] if `transitions` is an empty `Array`. + def initialize(identifier, transitions) + super(identifier) + raise ArgumentError, 'transitions must be specified' unless transitions + raise ArgumentError, 'transitions must not be an empty Array' if transitions.empty? + @transitions = transitions.freeze + end + + # (see DataTimezoneInfo#period_for) + def period_for(timestamp) + raise ArgumentError, 'timestamp must be specified' unless timestamp + raise ArgumentError, 'timestamp must have a specified utc_offset' unless timestamp.utc_offset + + timestamp_value = timestamp.value + + index = find_minimum_transition {|t| t.timestamp_value >= timestamp_value } + + if index + transition = @transitions[index] + + if transition.timestamp_value == timestamp_value + # timestamp occurs within the second of the found transition, so is + # the transition that starts the period. + start_transition = transition + end_transition = @transitions[index + 1] + else + # timestamp occurs before the second of the found transition, so is + # the transition that ends the period. + start_transition = index == 0 ? nil : @transitions[index - 1] + end_transition = transition + end + else + start_transition = @transitions.last + end_transition = nil + end + + TransitionsTimezonePeriod.new(start_transition, end_transition) + end + + # (see DataTimezoneInfo#periods_for_local) + def periods_for_local(local_timestamp) + raise ArgumentError, 'local_timestamp must be specified' unless local_timestamp + raise ArgumentError, 'local_timestamp must have an unspecified utc_offset' if local_timestamp.utc_offset + + local_timestamp_value = local_timestamp.value + latest_possible_utc_value = local_timestamp_value + 86400 + earliest_possible_utc_value = local_timestamp_value - 86400 + + # Find the index of the first transition that occurs after a latest + # possible UTC representation of the local timestamp and then search + # backwards until an earliest possible UTC representation. + + index = find_minimum_transition {|t| t.timestamp_value >= latest_possible_utc_value } + + # No transitions after latest_possible_utc_value, set to max index + 1 + # to search backwards including the period after the last transition + index = @transitions.length unless index + + result = [] + + index.downto(0) do |i| + start_transition = i > 0 ? @transitions[i - 1] : nil + end_transition = @transitions[i] + offset = start_transition ? start_transition.offset : end_transition.previous_offset + utc_timestamp_value = local_timestamp_value - offset.observed_utc_offset + + # It is not necessary to compare the sub-seconds because a timestamp + # is in the period if is >= the start transition (sub-seconds would + # make == become >) and if it is < the end transition (which + # sub-seconds cannot affect). + if (!start_transition || utc_timestamp_value >= start_transition.timestamp_value) && (!end_transition || utc_timestamp_value < end_transition.timestamp_value) + result << TransitionsTimezonePeriod.new(start_transition, end_transition) + elsif end_transition && end_transition.timestamp_value < earliest_possible_utc_value + break + end + end + + result.reverse! + end + + # (see DataTimezoneInfo#transitions_up_to) + def transitions_up_to(to_timestamp, from_timestamp = nil) + raise ArgumentError, 'to_timestamp must be specified' unless to_timestamp + raise ArgumentError, 'to_timestamp must have a specified utc_offset' unless to_timestamp.utc_offset + + if from_timestamp + raise ArgumentError, 'from_timestamp must have a specified utc_offset' unless from_timestamp.utc_offset + raise ArgumentError, 'to_timestamp must be greater than from_timestamp' if to_timestamp <= from_timestamp + end + + if from_timestamp + from_index = find_minimum_transition {|t| transition_on_or_after_timestamp?(t, from_timestamp) } + return [] unless from_index + else + from_index = 0 + end + + to_index = find_minimum_transition {|t| transition_on_or_after_timestamp?(t, to_timestamp) } + + if to_index + return [] if to_index < 1 + to_index -= 1 + else + to_index = -1 + end + + @transitions[from_index..to_index] + end + + private + + # Array#bsearch_index was added in Ruby 2.3.0. Use bsearch_index to find + # transitions if it is available, otherwise use a Ruby implementation. + if [].respond_to?(:bsearch_index) + # Performs a binary search on {transitions} to find the index of the + # earliest transition satisfying a condition. + # + # @yield [transition] the caller will be yielded to to test the search + # condition. + # @yieldparam transition [TimezoneTransition] a {TimezoneTransition} + # instance from {transitions}. + # @yieldreturn [Boolean] `true` for the earliest transition that + # satisfies the condition and return `true` for all subsequent + # transitions. In all other cases, the result of the block must be + # `false`. + # @return [Integer] the index of the earliest transition safisfying + # the condition or `nil` if there are no such transitions. + # + # :nocov_no_array_bsearch_index: + def find_minimum_transition(&block) + @transitions.bsearch_index(&block) + end + # :nocov_no_array_bsearch_index: + else + # Performs a binary search on {transitions} to find the index of the + # earliest transition satisfying a condition. + # + # @yield [transition] the caller will be yielded to to test the search + # condition. + # @yieldparam transition [TimezoneTransition] a {TimezoneTransition} + # instance from {transitions}. + # @yieldreturn [Boolean] `true` for the earliest transition that + # satisfies the condition and return `true` for all subsequent + # transitions. In all other cases, the result of the block must be + # `false`. + # @return [Integer] the index of the earliest transition safisfying + # the condition or `nil` if there are no such transitions. + # + # :nocov_array_bsearch_index: + def find_minimum_transition + # A Ruby implementation of the find-minimum mode of Array#bsearch_index. + low = 0 + high = @transitions.length + satisfied = false + + while low < high do + mid = (low + high).div(2) + if yield @transitions[mid] + satisfied = true + high = mid + else + low = mid + 1 + end + end + + satisfied ? low : nil + end + # :nocov_array_bsearch_index: + end + + # Determines if a transition occurs at or after a given {Timestamp}, + # taking the {Timestamp#sub_second sub_second} into consideration. + # + # @param transition [TimezoneTransition] the transition to compare. + # @param timestamp [Timestamp] the timestamp to compare. + # @return [Boolean] `true` if `transition` occurs at or after `timestamp`, + # otherwise `false`. + def transition_on_or_after_timestamp?(transition, timestamp) + transition_timestamp_value = transition.timestamp_value + timestamp_value = timestamp.value + transition_timestamp_value > timestamp_value || transition_timestamp_value == timestamp_value && timestamp.sub_second == 0 + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/zoneinfo_data_source.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/zoneinfo_data_source.rb new file mode 100644 index 0000000000..cb76c3a2e8 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/zoneinfo_data_source.rb @@ -0,0 +1,580 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + # Use send as a workaround for erroneous 'wrong number of arguments' errors + # with JRuby 9.0.5.0 when calling methods with Java implementations. See #114. + send(:using, UntaintExt) if TZInfo.const_defined?(:UntaintExt) + + module DataSources + # An {InvalidZoneinfoDirectory} exception is raised if {ZoneinfoDataSource} + # is initialized with a specific zoneinfo path that is not a valid zoneinfo + # directory. A valid zoneinfo directory is one that contains time zone + # files, a country code index file named iso3166.tab and a time zone index + # file named zone1970.tab or zone.tab. + class InvalidZoneinfoDirectory < StandardError + end + + # A {ZoneinfoDirectoryNotFound} exception is raised if no valid zoneinfo + # directory could be found when checking the paths listed in + # {ZoneinfoDataSource.search_path}. A valid zoneinfo directory is one that + # contains time zone files, a country code index file named iso3166.tab and + # a time zone index file named zone1970.tab or zone.tab. + class ZoneinfoDirectoryNotFound < StandardError + end + + # A DataSource implementation that loads data from a 'zoneinfo' directory + # containing compiled "TZif" version 3 (or earlier) files in addition to + # iso3166.tab and zone1970.tab or zone.tab index files. + # + # To have TZInfo load the system zoneinfo files, call + # {TZInfo::DataSource.set} as follows: + # + # TZInfo::DataSource.set(:zoneinfo) + # + # To load zoneinfo files from a particular directory, pass the directory to + # {TZInfo::DataSource.set}: + # + # TZInfo::DataSource.set(:zoneinfo, directory) + # + # To load zoneinfo files from a particular directory, but load the + # iso3166.tab index file from a separate location, pass the directory and + # path to the iso3166.tab file to {TZInfo::DataSource.set}: + # + # TZInfo::DataSource.set(:zoneinfo, directory, iso3166_path) + # + # Please note that versions of the 'zic' tool (used to build zoneinfo files) + # that were released prior to February 2006 created zoneinfo files that used + # 32-bit integers for transition timestamps. Later versions of zic produce + # zoneinfo files that use 64-bit integers. If you have 32-bit zoneinfo files + # on your system, then any queries falling outside of the range 1901-12-13 + # 20:45:52 to 2038-01-19 03:14:07 may be inaccurate. + # + # Most modern platforms include 64-bit zoneinfo files. However, Mac OS X (up + # to at least 10.8.4) still uses 32-bit zoneinfo files. + # + # To check whether your zoneinfo files contain 32-bit or 64-bit transition + # data, you can run the following code (substituting the identifier of the + # zone you want to test for `zone_identifier`): + # + # TZInfo::DataSource.set(:zoneinfo) + # dir = TZInfo::DataSource.get.zoneinfo_dir + # File.open(File.join(dir, zone_identifier), 'r') {|f| f.read(5) } + # + # If the last line returns `"TZif\\x00"`, then you have a 32-bit zoneinfo + # file. If it returns `"TZif2"` or `"TZif3"` then you have a 64-bit zoneinfo + # file. + # + # It is also worth noting that as of the 2017c release of the IANA Time Zone + # Database, 64-bit zoneinfo files only include future transitions up to + # 2038-01-19 03:14:07. Any queries falling after this time may be + # inaccurate. + class ZoneinfoDataSource < DataSource + # The default value of {ZoneinfoDataSource.search_path}. + DEFAULT_SEARCH_PATH = ['/usr/share/zoneinfo', '/usr/share/lib/zoneinfo', '/etc/zoneinfo'].freeze + private_constant :DEFAULT_SEARCH_PATH + + # The default value of {ZoneinfoDataSource.alternate_iso3166_tab_search_path}. + DEFAULT_ALTERNATE_ISO3166_TAB_SEARCH_PATH = ['/usr/share/misc/iso3166.tab', '/usr/share/misc/iso3166'].freeze + private_constant :DEFAULT_ALTERNATE_ISO3166_TAB_SEARCH_PATH + + # Paths to be checked to find the system zoneinfo directory. + # + # @private + @@search_path = DEFAULT_SEARCH_PATH.dup + + # Paths to possible alternate iso3166.tab files (used to locate the + # system-wide iso3166.tab files on FreeBSD and OpenBSD). + # + # @private + @@alternate_iso3166_tab_search_path = DEFAULT_ALTERNATE_ISO3166_TAB_SEARCH_PATH.dup + + class << self + # An `Array` of directories that will be checked to find the system + # zoneinfo directory. + # + # Directories are checked in the order they appear in the `Array`. + # + # The default value is `['/usr/share/zoneinfo', + # '/usr/share/lib/zoneinfo', '/etc/zoneinfo']`. + # + # @return [Array] an `Array` of directories to check in order to + # find the system zoneinfo directory. + def search_path + @@search_path + end + + # Sets the directories to be checked when locating the system zoneinfo + # directory. + # + # Can be set to an `Array` of directories or a `String` containing + # directories separated with `File::PATH_SEPARATOR`. + # + # Directories are checked in the order they appear in the `Array` or + # `String`. + # + # Set to `nil` to revert to the default paths. + # + # @param search_path [Object] either `nil` or a list of directories to + # check as either an `Array` of `String` or a `File::PATH_SEPARATOR` + # separated `String`. + def search_path=(search_path) + @@search_path = process_search_path(search_path, DEFAULT_SEARCH_PATH) + end + + # An `Array` of paths that will be checked to find an alternate + # iso3166.tab file if one was not included in the zoneinfo directory + # (for example, on FreeBSD and OpenBSD systems). + # + # Paths are checked in the order they appear in the `Array`. + # + # The default value is `['/usr/share/misc/iso3166.tab', + # '/usr/share/misc/iso3166']`. + # + # @return [Array] an `Array` of paths to check in order to + # locate an iso3166.tab file. + def alternate_iso3166_tab_search_path + @@alternate_iso3166_tab_search_path + end + + # Sets the paths to check to locate an alternate iso3166.tab file if one + # was not included in the zoneinfo directory. + # + # Can be set to an `Array` of paths or a `String` containing paths + # separated with `File::PATH_SEPARATOR`. + # + # Paths are checked in the order they appear in the array. + # + # Set to `nil` to revert to the default paths. + # + # @param alternate_iso3166_tab_search_path [Object] either `nil` or a + # list of paths to check as either an `Array` of `String` or a + # `File::PATH_SEPARATOR` separated `String`. + def alternate_iso3166_tab_search_path=(alternate_iso3166_tab_search_path) + @@alternate_iso3166_tab_search_path = process_search_path(alternate_iso3166_tab_search_path, DEFAULT_ALTERNATE_ISO3166_TAB_SEARCH_PATH) + end + + private + + # Processes a path for use as the {search_path} or + # {alternate_iso3166_tab_search_path}. + # + # @param path [Object] either `nil` or a list of paths to check as + # either an `Array` of `String` or a `File::PATH_SEPARATOR` separated + # `String`. + # @param default [Array] the default value. + # @return [Array] the processed path. + def process_search_path(path, default) + if path + if path.kind_of?(String) + path.split(File::PATH_SEPARATOR) + else + path.collect(&:to_s) + end + else + default.dup + end + end + end + + # @return [String] the zoneinfo directory being used. + attr_reader :zoneinfo_dir + + # (see DataSource#country_codes) + attr_reader :country_codes + + # Initializes a new {ZoneinfoDataSource}. + # + # If `zoneinfo_dir` is specified, it will be checked and used as the + # source of zoneinfo files. + # + # The directory must contain a file named iso3166.tab and a file named + # either zone1970.tab or zone.tab. These may either be included in the + # root of the directory or in a 'tab' sub-directory and named country.tab + # and zone_sun.tab respectively (as is the case on Solaris). + # + # Additionally, the path to iso3166.tab can be overridden using the + # `alternate_iso3166_tab_path` parameter. + # + # If `zoneinfo_dir` is not specified or `nil`, the paths referenced in + # {search_path} are searched in order to find a valid zoneinfo directory + # (one that contains zone1970.tab or zone.tab and iso3166.tab files as + # above). + # + # The paths referenced in {alternate_iso3166_tab_search_path} are also + # searched to find an iso3166.tab file if one of the searched zoneinfo + # directories doesn't contain an iso3166.tab file. + # + # @param zoneinfo_dir [String] an optional path to a directory to use as + # the source of zoneinfo files. + # @param alternate_iso3166_tab_path [String] an optional path to the + # iso3166.tab file. + # @raise [InvalidZoneinfoDirectory] if the iso3166.tab and zone1970.tab or + # zone.tab files cannot be found using the `zoneinfo_dir` and + # `alternate_iso3166_tab_path` parameters. + # @raise [ZoneinfoDirectoryNotFound] if no valid directory can be found + # by searching. + def initialize(zoneinfo_dir = nil, alternate_iso3166_tab_path = nil) + super() + + if zoneinfo_dir + iso3166_tab_path, zone_tab_path = validate_zoneinfo_dir(zoneinfo_dir, alternate_iso3166_tab_path) + + unless iso3166_tab_path && zone_tab_path + raise InvalidZoneinfoDirectory, "#{zoneinfo_dir} is not a directory or doesn't contain a iso3166.tab file and a zone1970.tab or zone.tab file." + end + + @zoneinfo_dir = zoneinfo_dir + else + @zoneinfo_dir, iso3166_tab_path, zone_tab_path = find_zoneinfo_dir + + unless @zoneinfo_dir && iso3166_tab_path && zone_tab_path + raise ZoneinfoDirectoryNotFound, "None of the paths included in #{self.class.name}.search_path are valid zoneinfo directories." + end + end + + @zoneinfo_dir = File.expand_path(@zoneinfo_dir).freeze + @timezone_identifiers = load_timezone_identifiers.freeze + @countries = load_countries(iso3166_tab_path, zone_tab_path).freeze + @country_codes = @countries.keys.sort!.freeze + + string_deduper = ConcurrentStringDeduper.new + posix_tz_parser = PosixTimeZoneParser.new(string_deduper) + @zoneinfo_reader = ZoneinfoReader.new(posix_tz_parser, string_deduper) + end + + # Returns a frozen `Array` of all the available time zone identifiers. The + # identifiers are sorted according to `String#<=>`. + # + # @return [Array] a frozen `Array` of all the available time zone + # identifiers. + def data_timezone_identifiers + @timezone_identifiers + end + + # Returns an empty `Array`. There is no information about linked/aliased + # time zones in the zoneinfo files. When using {ZoneinfoDataSource}, every + # time zone will be returned as a {DataTimezone}. + # + # @return [Array] an empty `Array`. + def linked_timezone_identifiers + [].freeze + end + + # (see DataSource#to_s) + def to_s + "Zoneinfo DataSource: #{@zoneinfo_dir}" + end + + # (see DataSource#inspect) + def inspect + "#<#{self.class}: #{@zoneinfo_dir}>" + end + + protected + + # Returns a {TimezoneInfo} instance for the given time zone identifier. + # The result will either be a {ConstantOffsetDataTimezoneInfo} or a + # {TransitionsDataTimezoneInfo}. + # + # @param identifier [String] A time zone identifier. + # @return [TimezoneInfo] a {TimezoneInfo} instance for the given time zone + # identifier. + # @raise [InvalidTimezoneIdentifier] if the time zone is not found, the + # identifier is invalid, the zoneinfo file cannot be opened or the + # zoneinfo file is not valid. + def load_timezone_info(identifier) + valid_identifier = validate_timezone_identifier(identifier) + path = File.join(@zoneinfo_dir, valid_identifier) + + zoneinfo = begin + @zoneinfo_reader.read(path) + rescue Errno::EACCES, InvalidZoneinfoFile => e + raise InvalidTimezoneIdentifier, "#{e.message.encode(Encoding::UTF_8)} (loading #{valid_identifier})" + rescue Errno::EISDIR, Errno::ENAMETOOLONG, Errno::ENOENT, Errno::ENOTDIR + raise InvalidTimezoneIdentifier, "Invalid identifier: #{valid_identifier}" + end + + if zoneinfo.kind_of?(TimezoneOffset) + ConstantOffsetDataTimezoneInfo.new(valid_identifier, zoneinfo) + else + TransitionsDataTimezoneInfo.new(valid_identifier, zoneinfo) + end + end + + # (see DataSource#load_country_info) + def load_country_info(code) + lookup_country_info(@countries, code) + end + + private + + # Validates a zoneinfo directory and returns the paths to the iso3166.tab + # and zone1970.tab or zone.tab files if valid. If the directory is not + # valid, returns `nil`. + # + # The path to the iso3166.tab file may be overridden by passing in a path. + # This is treated as either absolute or relative to the current working + # directory. + # + # @param path [String] the path to a possible zoneinfo directory. + # @param iso3166_tab_path [String] an optional path to an external + # iso3166.tab file. + # @return [Array] an `Array` containing the iso3166.tab and + # zone.tab paths if the directory is valid, otherwise `nil`. + def validate_zoneinfo_dir(path, iso3166_tab_path = nil) + if File.directory?(path) + if iso3166_tab_path + return nil unless File.file?(iso3166_tab_path) + else + iso3166_tab_path = resolve_tab_path(path, ['iso3166.tab'], 'country.tab') + return nil unless iso3166_tab_path + end + + zone_tab_path = resolve_tab_path(path, ['zone1970.tab', 'zone.tab'], 'zone_sun.tab') + return nil unless zone_tab_path + + [iso3166_tab_path, zone_tab_path] + else + nil + end + end + + # Attempts to resolve the path to a tab file given its standard names and + # tab sub-directory name (as used on Solaris). + # + # @param zoneinfo_path [String] the path to a zoneinfo directory. + # @param standard_names [Array] the standard names for the tab + # file. + # @param tab_name [String] the alternate name for the tab file to check in + # the tab sub-directory. + # @return [String] the path to the tab file. + def resolve_tab_path(zoneinfo_path, standard_names, tab_name) + standard_names.each do |standard_name| + path = File.join(zoneinfo_path, standard_name) + return path if File.file?(path) + end + + path = File.join(zoneinfo_path, 'tab', tab_name) + return path if File.file?(path) + + nil + end + + # Finds a zoneinfo directory using {search_path} and + # {alternate_iso3166_tab_search_path}. + # + # @return [Array] an `Array` containing the iso3166.tab and + # zone.tab paths if a zoneinfo directory was found, otherwise `nil`. + def find_zoneinfo_dir + alternate_iso3166_tab_path = self.class.alternate_iso3166_tab_search_path.detect do |path| + File.file?(path) + end + + self.class.search_path.each do |path| + # Try without the alternate_iso3166_tab_path first. + iso3166_tab_path, zone_tab_path = validate_zoneinfo_dir(path) + return path, iso3166_tab_path, zone_tab_path if iso3166_tab_path && zone_tab_path + + if alternate_iso3166_tab_path + iso3166_tab_path, zone_tab_path = validate_zoneinfo_dir(path, alternate_iso3166_tab_path) + return path, iso3166_tab_path, zone_tab_path if iso3166_tab_path && zone_tab_path + end + end + + # Not found. + nil + end + + # Scans @zoneinfo_dir and returns an `Array` of available time zone + # identifiers. The result is sorted according to `String#<=>`. + # + # @return [Array] an `Array` containing all the time zone + # identifiers found. + def load_timezone_identifiers + index = [] + + # Ignoring particular files: + # +VERSION is included on Mac OS X. + # leapseconds is a list of leap seconds. + # localtime is the current local timezone (may be a link). + # posix, posixrules and right are directories containing other versions of the zoneinfo files. + # src is a directory containing the tzdata source included on Solaris. + # timeconfig is a symlink included on Slackware. + + enum_timezones([], ['+VERSION', 'leapseconds', 'localtime', 'posix', 'posixrules', 'right', 'src', 'timeconfig']) do |identifier| + index << identifier.join('/').freeze + end + + index.sort! + end + + # Recursively enumerate a directory of time zones. + # + # @param dir [Array] the directory to enumerate as an `Array` of + # path components. + # @param exclude [Array] file names to exclude when scanning + # `dir`. + # @yield [path] the path of each time zone file found is passed to + # the block. + # @yieldparam path [Array] the path of a time zone file as an + # `Array` of path components. + def enum_timezones(dir, exclude = [], &block) + Dir.foreach(File.join(@zoneinfo_dir, *dir)) do |entry| + begin + entry.encode!(Encoding::UTF_8) + rescue EncodingError + next + end + + unless entry =~ /\./ || exclude.include?(entry) + entry.untaint + path = dir + [entry] + full_path = File.join(@zoneinfo_dir, *path) + + if File.directory?(full_path) + enum_timezones(path, [], &block) + elsif File.file?(full_path) + yield path + end + end + end + end + + # Uses the iso3166.tab and zone1970.tab or zone.tab files to return a Hash + # mapping country codes to CountryInfo instances. + # + # @param iso3166_tab_path [String] the path to the iso3166.tab file. + # @param zone_tab_path [String] the path to the zone.tab file. + # @return [Hash] a mapping from ISO 3166-1 alpha-2 + # country codes to {CountryInfo} instances. + def load_countries(iso3166_tab_path, zone_tab_path) + + # Handle standard 3 to 4 column zone.tab files as well as the 4 to 5 + # column format used by Solaris. + # + # On Solaris, an extra column before the comment gives an optional + # linked/alternate timezone identifier (or '-' if not set). + # + # Additionally, there is a section at the end of the file for timezones + # covering regions. These are given lower-case "country" codes. The timezone + # identifier column refers to a continent instead of an identifier. These + # lines will be ignored by TZInfo. + # + # Since the last column is optional in both formats, testing for the + # Solaris format is done in two passes. The first pass identifies if there + # are any lines using 5 columns. + + + # The first column is allowed to be a comma separated list of country + # codes, as used in zone1970.tab (introduced in tzdata 2014f). + # + # The first country code in the comma-separated list is the country that + # contains the city the zone identifier is based on. The first country + # code on each line is considered to be primary with the others + # secondary. + # + # The zones for each country are ordered primary first, then secondary. + # Within the primary and secondary groups, the zones are ordered by their + # order in the file. + + file_is_5_column = false + zone_tab = [] + + file = File.read(zone_tab_path, external_encoding: Encoding::UTF_8, internal_encoding: Encoding::UTF_8) + file.each_line do |line| + line.chomp! + + if line =~ /\A([A-Z]{2}(?:,[A-Z]{2})*)\t(?:([+\-])(\d{2})(\d{2})([+\-])(\d{3})(\d{2})|([+\-])(\d{2})(\d{2})(\d{2})([+\-])(\d{3})(\d{2})(\d{2}))\t([^\t]+)(?:\t([^\t]+))?(?:\t([^\t]+))?\z/ + codes = $1 + + if $2 + latitude = dms_to_rational($2, $3, $4) + longitude = dms_to_rational($5, $6, $7) + else + latitude = dms_to_rational($8, $9, $10, $11) + longitude = dms_to_rational($12, $13, $14, $15) + end + + zone_identifier = $16 + column4 = $17 + column5 = $18 + + file_is_5_column = true if column5 + + zone_tab << [codes.split(','.freeze), zone_identifier, latitude, longitude, column4, column5] + end + end + + string_deduper = StringDeduper.new + primary_zones = {} + secondary_zones = {} + + zone_tab.each do |codes, zone_identifier, latitude, longitude, column4, column5| + description = file_is_5_column ? column5 : column4 + description = string_deduper.dedupe(description) if description + + # Lookup the identifier in the timezone index, so that the same + # String instance can be used (saving memory). + begin + zone_identifier = validate_timezone_identifier(zone_identifier) + rescue InvalidTimezoneIdentifier + # zone_identifier is not valid, dedupe and allow anyway. + zone_identifier = string_deduper.dedupe(zone_identifier) + end + + country_timezone = CountryTimezone.new(zone_identifier, latitude, longitude, description) + + # codes will always have at least one element + + (primary_zones[codes.first.freeze] ||= []) << country_timezone + + codes[1..-1].each do |code| + (secondary_zones[code.freeze] ||= []) << country_timezone + end + end + + countries = {} + + file = File.read(iso3166_tab_path, external_encoding: Encoding::UTF_8, internal_encoding: Encoding::UTF_8) + file.each_line do |line| + line.chomp! + + # Handle both the two column alpha-2 and name format used in the tz + # database as well as the 4 column alpha-2, alpha-3, numeric-3 and + # name format used by FreeBSD and OpenBSD. + + if line =~ /\A([A-Z]{2})(?:\t[A-Z]{3}\t[0-9]{3})?\t(.+)\z/ + code = $1 + name = $2 + zones = (primary_zones[code] || []) + (secondary_zones[code] || []) + + countries[code] = CountryInfo.new(code, name, zones) + end + end + + countries + end + + # Converts degrees, minutes and seconds to a Rational. + # + # @param sign [String] `'-'` or `'+'`. + # @param degrees [String] the number of degrees. + # @param minutes [String] the number of minutes. + # @param seconds [String] the number of seconds (optional). + # @return [Rational] the result of converting from degrees, minutes and + # seconds to a `Rational`. + def dms_to_rational(sign, degrees, minutes, seconds = nil) + degrees = degrees.to_i + minutes = minutes.to_i + sign = sign == '-'.freeze ? -1 : 1 + + if seconds + Rational(sign * (degrees * 3600 + minutes * 60 + seconds.to_i), 3600) + else + Rational(sign * (degrees * 60 + minutes), 60) + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/zoneinfo_reader.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/zoneinfo_reader.rb new file mode 100644 index 0000000000..ffa83ea334 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_sources/zoneinfo_reader.rb @@ -0,0 +1,483 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + # Use send as a workaround for erroneous 'wrong number of arguments' errors + # with JRuby 9.0.5.0 when calling methods with Java implementations. See #114. + send(:using, UntaintExt) if TZInfo.const_defined?(:UntaintExt) + + module DataSources + # An {InvalidZoneinfoFile} exception is raised if an attempt is made to load + # an invalid zoneinfo file. + class InvalidZoneinfoFile < StandardError + end + + # Reads compiled zoneinfo TZif (\0, 2 or 3) files. + class ZoneinfoReader #:nodoc: + # The year to generate transitions up to. + # + # @private + GENERATE_UP_TO = Time.now.utc.year + 100 + private_constant :GENERATE_UP_TO + + # Initializes a new {ZoneinfoReader}. + # + # @param posix_tz_parser [PosixTimeZoneParser] a {PosixTimeZoneParser} + # instance to use to parse POSIX-style TZ strings. + # @param string_deduper [StringDeduper] a {StringDeduper} instance to use + # to dedupe abbreviations. + def initialize(posix_tz_parser, string_deduper) + @posix_tz_parser = posix_tz_parser + @string_deduper = string_deduper + end + + # Reads a zoneinfo structure from the given path. Returns either a + # {TimezoneOffset} that is constantly observed or an `Array` + # {TimezoneTransition}s. + # + # @param file_path [String] the path of a zoneinfo file. + # @return [Object] either a {TimezoneOffset} or an `Array` of + # {TimezoneTransition}s. + # @raise [SecurityError] if safe mode is enabled and `file_path` is + # tainted. + # @raise [InvalidZoneinfoFile] if `file_path`` does not refer to a valid + # zoneinfo file. + def read(file_path) + File.open(file_path, 'rb') { |file| parse(file) } + end + + private + + # Translates an unsigned 32-bit integer (as returned by unpack) to signed + # 32-bit. + # + # @param long [Integer] an unsigned 32-bit integer. + # @return [Integer] {long} translated to signed 32-bit. + def make_signed_int32(long) + long >= 0x80000000 ? long - 0x100000000 : long + end + + # Translates a pair of unsigned 32-bit integers (as returned by unpack, + # most significant first) to a signed 64-bit integer. + # + # @param high [Integer] the most significant 32-bits. + # @param low [Integer] the least significant 32-bits. + # @return [Integer] {high} and {low} combined and translated to signed + # 64-bit. + def make_signed_int64(high, low) + unsigned = (high << 32) | low + unsigned >= 0x8000000000000000 ? unsigned - 0x10000000000000000 : unsigned + end + + # Reads the given number of bytes from the given file and checks that the + # correct number of bytes could be read. + # + # @param file [IO] the file to read from. + # @param bytes [Integer] the number of bytes to read. + # @return [String] the bytes that were read. + # @raise [InvalidZoneinfoFile] if the number of bytes available didn't + # match the number requested. + def check_read(file, bytes) + result = file.read(bytes) + + unless result && result.length == bytes + raise InvalidZoneinfoFile, "Expected #{bytes} bytes reading '#{file.path}', but got #{result ? result.length : 0} bytes" + end + + result + end + + # Zoneinfo files don't include the offset from standard time (std_offset) + # for DST periods. Derive the base offset (base_utc_offset) where DST is + # observed from either the previous or next non-DST period. + # + # @param transitions [Array] an `Array` of transition hashes. + # @param offsets [Array] an `Array` of offset hashes. + # @return [Integer] the index of the offset to be used prior to the first + # transition. + def derive_offsets(transitions, offsets) + # The first non-DST offset (if there is one) is the offset observed + # before the first transition. Fall back to the first DST offset if + # there are no non-DST offsets. + first_non_dst_offset_index = offsets.index {|o| !o[:is_dst] } + first_offset_index = first_non_dst_offset_index || 0 + return first_offset_index if transitions.empty? + + # Determine the base_utc_offset of the next non-dst offset at each transition. + base_utc_offset_from_next = nil + + transitions.reverse_each do |transition| + offset = offsets[transition[:offset]] + if offset[:is_dst] + transition[:base_utc_offset_from_next] = base_utc_offset_from_next if base_utc_offset_from_next + else + base_utc_offset_from_next = offset[:observed_utc_offset] + end + end + + base_utc_offset_from_previous = first_non_dst_offset_index ? offsets[first_non_dst_offset_index][:observed_utc_offset] : nil + defined_offsets = {} + + transitions.each do |transition| + offset_index = transition[:offset] + offset = offsets[offset_index] + observed_utc_offset = offset[:observed_utc_offset] + + if offset[:is_dst] + base_utc_offset_from_next = transition[:base_utc_offset_from_next] + + difference_to_previous = (observed_utc_offset - (base_utc_offset_from_previous || observed_utc_offset)).abs + difference_to_next = (observed_utc_offset - (base_utc_offset_from_next || observed_utc_offset)).abs + + base_utc_offset = if difference_to_previous == 3600 + base_utc_offset_from_previous + elsif difference_to_next == 3600 + base_utc_offset_from_next + elsif difference_to_previous > 0 && difference_to_next > 0 + difference_to_previous < difference_to_next ? base_utc_offset_from_previous : base_utc_offset_from_next + elsif difference_to_previous > 0 + base_utc_offset_from_previous + elsif difference_to_next > 0 + base_utc_offset_from_next + else + # No difference, assume a 1 hour offset from standard time. + observed_utc_offset - 3600 + end + + if !offset[:base_utc_offset] + offset[:base_utc_offset] = base_utc_offset + defined_offsets[offset] = offset_index + elsif offset[:base_utc_offset] != base_utc_offset + # An earlier transition has already derived a different + # base_utc_offset. Define a new offset or reuse an existing identically + # defined offset. + new_offset = offset.dup + new_offset[:base_utc_offset] = base_utc_offset + + offset_index = defined_offsets[new_offset] + + unless offset_index + offsets << new_offset + offset_index = offsets.length - 1 + defined_offsets[new_offset] = offset_index + end + + transition[:offset] = offset_index + end + else + base_utc_offset_from_previous = observed_utc_offset + end + end + + first_offset_index + end + + # Determines if the offset from a transition matches the offset from a + # rule. This is a looser match than equality, not requiring that the + # base_utc_offset and std_offset both match (which have to be derived for + # transitions, but are known for rules. + # + # @param offset [TimezoneOffset] an offset from a transition. + # @param rule_offset [TimezoneOffset] an offset from a rule. + # @return [Boolean] whether the offsets match. + def offset_matches_rule?(offset, rule_offset) + offset.observed_utc_offset == rule_offset.observed_utc_offset && + offset.dst? == rule_offset.dst? && + offset.abbreviation == rule_offset.abbreviation + end + + # Apply the rules from the TZ string when there were no defined + # transitions. Checks for a matching offset. Returns the rules-based + # constant offset or generates transitions from 1970 until 100 years into + # the future (at the time of loading zoneinfo_reader.rb). + # + # @param file [IO] the file being processed. + # @param first_offset [TimezoneOffset] the first offset included in the + # file that would normally apply without the rules. + # @param rules [Object] a {TimezoneOffset} specifying a constant offset or + # {AnnualRules} instance specfying transitions. + # @return [Object] either a {TimezoneOffset} or an `Array` of + # {TimezoneTransition}s. + # @raise [InvalidZoneinfoFile] if the first offset does not match the + # rules. + def apply_rules_without_transitions(file, first_offset, rules) + if rules.kind_of?(TimezoneOffset) + unless offset_matches_rule?(first_offset, rules) + raise InvalidZoneinfoFile, "Constant offset POSIX-style TZ string does not match constant offset in file '#{file.path}'." + end + rules + else + transitions = 1970.upto(GENERATE_UP_TO).flat_map {|y| rules.transitions(y) } + first_transition = transitions[0] + + unless offset_matches_rule?(first_offset, first_transition.previous_offset) + # Not transitioning from the designated first offset. + + if offset_matches_rule?(first_offset, first_transition.offset) + # Skip an unnecessary transition to the first offset. + transitions.shift + else + # The initial offset doesn't match the ongoing rules. Replace the + # previous offset of the first transition. + transitions[0] = TimezoneTransition.new(first_transition.offset, first_offset, first_transition.timestamp_value) + end + end + + transitions + end + end + + # Finds an offset that is equivalent to the one specified in the given + # `Array`. Matching is performed with {TimezoneOffset#==}. + # + # @param offsets [Array] an `Array` to search. + # @param offset [TimezoneOffset] the offset to search for. + # @return [TimezoneOffset] the matching offset from `offsets` or `nil` + # if not found. + def find_existing_offset(offsets, offset) + offsets.find {|o| o == offset } + end + + # Returns a new AnnualRules instance with standard and daylight savings + # offsets replaced with equivalents from an array. This reduces the memory + # requirement for loaded time zones by reusing offsets for rule-generated + # transitions. + # + # @param offsets [Array] an `Array` to search for + # equivalent offsets. + # @param annual_rules [AnnualRules] the {AnnualRules} instance to check. + # @return [AnnualRules] either a new {AnnualRules} instance with either + # the {AnnualRules#std_offset std_offset} or {AnnualRules#dst_offset + # dst_offset} replaced, or the original instance if no equivalent for + # either {AnnualRules#std_offset std_offset} or {AnnualRules#dst_offset + # dst_offset} could be found. + def replace_with_existing_offsets(offsets, annual_rules) + existing_std_offset = find_existing_offset(offsets, annual_rules.std_offset) + existing_dst_offset = find_existing_offset(offsets, annual_rules.dst_offset) + if existing_std_offset || existing_dst_offset + AnnualRules.new(existing_std_offset || annual_rules.std_offset, existing_dst_offset || annual_rules.dst_offset, + annual_rules.dst_start_rule, annual_rules.dst_end_rule) + else + annual_rules + end + end + + # Validates the offset indicated to be observed by the rules before the + # first generated transition against the offset of the last defined + # transition. + # + # Fix the last defined transition if it differ on just base/std offsets + # (which are derived). Raise an error if the observed UTC offset or + # abbreviations differ. + # + # @param file [IO] the file being processed. + # @param last_defined [TimezoneTransition] the last defined transition in + # the file. + # @param first_rule_offset [TimezoneOffset] the offset the rules indicate + # is observed prior to the first rules generated transition. + # @return [TimezoneTransition] the last defined transition (either the + # original instance or a replacement). + # @raise [InvalidZoneinfoFile] if the offset of {last_defined} and + # {first_rule_offset} do not match. + def validate_and_fix_last_defined_transition_offset(file, last_defined, first_rule_offset) + offset_of_last_defined = last_defined.offset + + if offset_of_last_defined == first_rule_offset + last_defined + else + if offset_matches_rule?(offset_of_last_defined, first_rule_offset) + # The same overall offset, but differing in the base or std + # offset (which are derived). Correct by using the rule. + TimezoneTransition.new(first_rule_offset, last_defined.previous_offset, last_defined.timestamp_value) + else + raise InvalidZoneinfoFile, "The first offset indicated by the POSIX-style TZ string did not match the final defined offset in file '#{file.path}'." + end + end + end + + # Apply the rules from the TZ string when there were defined + # transitions. Checks for a matching offset with the last transition. + # Redefines the last transition if required and if the rules don't + # specific a constant offset, generates transitions until 100 years into + # the future (at the time of loading zoneinfo_reader.rb). + # + # @param file [IO] the file being processed. + # @param transitions [Array] the defined transitions. + # @param offsets [Array] the offsets used by the defined + # transitions. + # @param rules [Object] a {TimezoneOffset} specifying a constant offset or + # {AnnualRules} instance specfying transitions. + # @raise [InvalidZoneinfoFile] if the first offset does not match the + # rules. + # @raise [InvalidZoneinfoFile] if the previous offset of the first + # generated transition does not match the offset of the last defined + # transition. + def apply_rules_with_transitions(file, transitions, offsets, rules) + last_defined = transitions[-1] + + if rules.kind_of?(TimezoneOffset) + transitions[-1] = validate_and_fix_last_defined_transition_offset(file, last_defined, rules) + else + last_year = last_defined.local_end_at.to_time.year + + if last_year <= GENERATE_UP_TO + rules = replace_with_existing_offsets(offsets, rules) + + generated = rules.transitions(last_year).find_all {|t| t.timestamp_value > last_defined.timestamp_value } + + (last_year + 1).upto(GENERATE_UP_TO).flat_map {|y| rules.transitions(y) } + + unless generated.empty? + transitions[-1] = validate_and_fix_last_defined_transition_offset(file, last_defined, generated[0].previous_offset) + transitions.concat(generated) + end + end + end + end + + # Parses a zoneinfo file and returns either a {TimezoneOffset} that is + # constantly observed or an `Array` of {TimezoneTransition}s. + # + # @param file [IO] the file to be read. + # @return [Object] either a {TimezoneOffset} or an `Array` of + # {TimezoneTransition}s. + # @raise [InvalidZoneinfoFile] if the file is not a valid zoneinfo file. + def parse(file) + magic, version, ttisutccnt, ttisstdcnt, leapcnt, timecnt, typecnt, charcnt = + check_read(file, 44).unpack('a4 a x15 NNNNNN') + + if magic != 'TZif' + raise InvalidZoneinfoFile, "The file '#{file.path}' does not start with the expected header." + end + + if version == '2' || version == '3' + # Skip the first 32-bit section and read the header of the second 64-bit section + file.seek(timecnt * 5 + typecnt * 6 + charcnt + leapcnt * 8 + ttisstdcnt + ttisutccnt, IO::SEEK_CUR) + + prev_version = version + + magic, version, ttisutccnt, ttisstdcnt, leapcnt, timecnt, typecnt, charcnt = + check_read(file, 44).unpack('a4 a x15 NNNNNN') + + unless magic == 'TZif' && (version == prev_version) + raise InvalidZoneinfoFile, "The file '#{file.path}' contains an invalid 64-bit section header." + end + + using_64bit = true + elsif version != '3' && version != '2' && version != "\0" + raise InvalidZoneinfoFile, "The file '#{file.path}' contains a version of the zoneinfo format that is not currently supported." + else + using_64bit = false + end + + unless leapcnt == 0 + raise InvalidZoneinfoFile, "The file '#{file.path}' contains leap second data. TZInfo requires zoneinfo files that omit leap seconds." + end + + transitions = if using_64bit + timecnt.times.map do |i| + high, low = check_read(file, 8).unpack('NN'.freeze) + transition_time = make_signed_int64(high, low) + {at: transition_time} + end + else + timecnt.times.map do |i| + transition_time = make_signed_int32(check_read(file, 4).unpack('N'.freeze)[0]) + {at: transition_time} + end + end + + check_read(file, timecnt).unpack('C*'.freeze).each_with_index do |localtime_type, i| + raise InvalidZoneinfoFile, "Invalid offset referenced by transition in file '#{file.path}'." if localtime_type >= typecnt + transitions[i][:offset] = localtime_type + end + + offsets = typecnt.times.map do |i| + gmtoff, isdst, abbrind = check_read(file, 6).unpack('NCC'.freeze) + gmtoff = make_signed_int32(gmtoff) + isdst = isdst == 1 + {observed_utc_offset: gmtoff, is_dst: isdst, abbr_index: abbrind} + end + + abbrev = check_read(file, charcnt) + + if using_64bit + # Skip to the POSIX-style TZ string. + file.seek(ttisstdcnt + ttisutccnt, IO::SEEK_CUR) # + leapcnt * 8, but leapcnt is checked above and guaranteed to be 0. + tz_string_start = check_read(file, 1) + raise InvalidZoneinfoFile, "Expected newline starting POSIX-style TZ string in file '#{file.path}'." unless tz_string_start == "\n" + tz_string = file.readline("\n").force_encoding(Encoding::UTF_8) + raise InvalidZoneinfoFile, "Expected newline ending POSIX-style TZ string in file '#{file.path}'." unless tz_string.chomp!("\n") + + begin + rules = @posix_tz_parser.parse(tz_string) + rescue InvalidPosixTimeZone => e + raise InvalidZoneinfoFile, "Failed to parse POSIX-style TZ string in file '#{file.path}': #{e}" + end + else + rules = nil + end + + # Derive the offsets from standard time (std_offset). + first_offset_index = derive_offsets(transitions, offsets) + + offsets = offsets.map do |o| + observed_utc_offset = o[:observed_utc_offset] + base_utc_offset = o[:base_utc_offset] + + if base_utc_offset + # DST offset with base_utc_offset derived by derive_offsets. + std_offset = observed_utc_offset - base_utc_offset + elsif o[:is_dst] + # DST offset unreferenced by a transition (offset in use before the + # first transition). No derived base UTC offset, so assume 1 hour + # DST. + base_utc_offset = observed_utc_offset - 3600 + std_offset = 3600 + else + # Non-DST offset. + base_utc_offset = observed_utc_offset + std_offset = 0 + end + + abbrev_start = o[:abbr_index] + raise InvalidZoneinfoFile, "Abbreviation index is out of range in file '#{file.path}'." unless abbrev_start < abbrev.length + + abbrev_end = abbrev.index("\0", abbrev_start) + raise InvalidZoneinfoFile, "Missing abbreviation null terminator in file '#{file.path}'." unless abbrev_end + + abbr = @string_deduper.dedupe(abbrev[abbrev_start...abbrev_end].force_encoding(Encoding::UTF_8).untaint) + + TimezoneOffset.new(base_utc_offset, std_offset, abbr) + end + + first_offset = offsets[first_offset_index] + + + if transitions.empty? + if rules + apply_rules_without_transitions(file, first_offset, rules) + else + first_offset + end + else + previous_offset = first_offset + previous_at = nil + + transitions = transitions.map do |t| + offset = offsets[t[:offset]] + at = t[:at] + raise InvalidZoneinfoFile, "Transition at #{at} is not later than the previous transition at #{previous_at} in file '#{file.path}'." if previous_at && previous_at >= at + tt = TimezoneTransition.new(offset, previous_offset, at) + previous_offset = offset + previous_at = at + tt + end + + apply_rules_with_transitions(file, transitions, offsets, rules) if rules + transitions + end + end + end + private_constant :ZoneinfoReader + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_timezone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_timezone.rb new file mode 100644 index 0000000000..a7c60d9c7a --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/data_timezone.rb @@ -0,0 +1,44 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + # Represents time zones that are defined by rules that set out when + # transitions occur. + class DataTimezone < InfoTimezone + # (see Timezone#period_for) + def period_for(time) + raise ArgumentError, 'time must be specified' unless time + timestamp = Timestamp.for(time) + raise ArgumentError, 'time must have a specified utc_offset' unless timestamp.utc_offset + info.period_for(timestamp) + end + + # (see Timezone#periods_for_local) + def periods_for_local(local_time) + raise ArgumentError, 'local_time must be specified' unless local_time + info.periods_for_local(Timestamp.for(local_time, :ignore)) + end + + # (see Timezone#transitions_up_to) + def transitions_up_to(to, from = nil) + raise ArgumentError, 'to must be specified' unless to + to_timestamp = Timestamp.for(to) + from_timestamp = from && Timestamp.for(from) + + begin + info.transitions_up_to(to_timestamp, from_timestamp) + rescue ArgumentError => e + raise ArgumentError, e.message.gsub('_timestamp', '') + end + end + + # Returns the canonical {Timezone} instance for this {DataTimezone}. + # + # For a {DataTimezone}, this is always `self`. + # + # @return [Timezone] `self`. + def canonical_zone + self + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/datetime_with_offset.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/datetime_with_offset.rb new file mode 100644 index 0000000000..63c4bedcbe --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/datetime_with_offset.rb @@ -0,0 +1,153 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +require 'date' + +module TZInfo + # A subclass of `DateTime` used to represent local times. {DateTimeWithOffset} + # holds a reference to the related {TimezoneOffset} and overrides various + # methods to return results appropriate for the {TimezoneOffset}. Certain + # operations will clear the associated {TimezoneOffset} (if the + # {TimezoneOffset} would not necessarily be valid for the result). Once the + # {TimezoneOffset} has been cleared, {DateTimeWithOffset} behaves identically + # to `DateTime`. + # + # Arithmetic performed on {DateTimeWithOffset} instances is _not_ time + # zone-aware. Regardless of whether transitions in the time zone are crossed, + # results of arithmetic operations will always maintain the same offset from + # UTC (`offset`). The associated {TimezoneOffset} will aways be cleared. + class DateTimeWithOffset < DateTime + include WithOffset + + # @return [TimezoneOffset] the {TimezoneOffset} associated with this + # instance. + attr_reader :timezone_offset + + # Sets the associated {TimezoneOffset}. + # + # @param timezone_offset [TimezoneOffset] a {TimezoneOffset} valid at the + # time and for the offset of this {DateTimeWithOffset}. + # @return [DateTimeWithOffset] `self`. + # @raise [ArgumentError] if `timezone_offset` is `nil`. + # @raise [ArgumentError] if `timezone_offset.observed_utc_offset` does not + # equal `self.offset * 86400`. + def set_timezone_offset(timezone_offset) + raise ArgumentError, 'timezone_offset must be specified' unless timezone_offset + raise ArgumentError, 'timezone_offset.observed_utc_offset does not match self.utc_offset' if offset * 86400 != timezone_offset.observed_utc_offset + @timezone_offset = timezone_offset + self + end + + # An overridden version of `DateTime#to_time` that, if there is an + # associated {TimezoneOffset}, returns a {DateTimeWithOffset} with that + # offset. + # + # @return [Time] if there is an associated {TimezoneOffset}, a + # {TimeWithOffset} representation of this {DateTimeWithOffset}, otherwise + # a `Time` representation. + def to_time + if_timezone_offset(super) do |o,t| + # Ruby 2.4.0 changed the behaviour of to_time so that it preserves the + # offset instead of converting to the system local timezone. + # + # When self has an associated TimezonePeriod, this implementation will + # preserve the offset on all versions of Ruby. + TimeWithOffset.at(t.to_i, t.subsec * 1_000_000).set_timezone_offset(o) + end + end + + # An overridden version of `DateTime#downto` that clears the associated + # {TimezoneOffset} of the returned or yielded instances. + def downto(min) + if block_given? + super {|dt| yield dt.clear_timezone_offset } + else + enum = super + enum.each {|dt| dt.clear_timezone_offset } + enum + end + end + + # An overridden version of `DateTime#england` that preserves the associated + # {TimezoneOffset}. + # + # @return [DateTime] + def england + # super doesn't call #new_start on MRI, so each method has to be + # individually overridden. + if_timezone_offset(super) {|o,dt| dt.set_timezone_offset(o) } + end + + # An overridden version of `DateTime#gregorian` that preserves the + # associated {TimezoneOffset}. + # + # @return [DateTime] + def gregorian + # super doesn't call #new_start on MRI, so each method has to be + # individually overridden. + if_timezone_offset(super) {|o,dt| dt.set_timezone_offset(o) } + end + + # An overridden version of `DateTime#italy` that preserves the associated + # {TimezoneOffset}. + # + # @return [DateTime] + def italy + # super doesn't call #new_start on MRI, so each method has to be + # individually overridden. + if_timezone_offset(super) {|o,dt| dt.set_timezone_offset(o) } + end + + # An overridden version of `DateTime#julian` that preserves the associated + # {TimezoneOffset}. + # + # @return [DateTime] + def julian + # super doesn't call #new_start on MRI, so each method has to be + # individually overridden. + if_timezone_offset(super) {|o,dt| dt.set_timezone_offset(o) } + end + + # An overridden version of `DateTime#new_start` that preserves the + # associated {TimezoneOffset}. + # + # @return [DateTime] + def new_start(start = Date::ITALY) + if_timezone_offset(super) {|o,dt| dt.set_timezone_offset(o) } + end + + # An overridden version of `DateTime#step` that clears the associated + # {TimezoneOffset} of the returned or yielded instances. + def step(limit, step = 1) + if block_given? + super {|dt| yield dt.clear_timezone_offset } + else + enum = super + enum.each {|dt| dt.clear_timezone_offset } + enum + end + end + + # An overridden version of `DateTime#upto` that clears the associated + # {TimezoneOffset} of the returned or yielded instances. + def upto(max) + if block_given? + super {|dt| yield dt.clear_timezone_offset } + else + enum = super + enum.each {|dt| dt.clear_timezone_offset } + enum + end + end + + protected + + # Clears the associated {TimezoneOffset}. + # + # @return [DateTimeWithOffset] `self`. + def clear_timezone_offset + @timezone_offset = nil + self + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1.rb new file mode 100644 index 0000000000..ff3a2eb24d --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1.rb @@ -0,0 +1,10 @@ +# encoding: UTF-8 + +module TZInfo + # Modules and classes used by the format 1 version of TZInfo::Data. + # + # @private + module Format1 #:nodoc: + end + private_constant :Format1 +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1/country_definer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1/country_definer.rb new file mode 100644 index 0000000000..67bf044b7f --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1/country_definer.rb @@ -0,0 +1,17 @@ +# encoding: UTF-8 + +module TZInfo + module Format1 + # Instances of {Format1::CountryDefiner} are yielded to the format 1 version + # of `TZInfo::Data::Indexes::Countries` by {CountryIndexDefinition} to allow + # the zones of a country to be specified. + # + # @private + class CountryDefiner < Format2::CountryDefiner #:nodoc: + # Initializes a new {CountryDefiner}. + def initialize(identifier_deduper, description_deduper) + super(nil, identifier_deduper, description_deduper) + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1/country_index_definition.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1/country_index_definition.rb new file mode 100644 index 0000000000..040ed24975 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1/country_index_definition.rb @@ -0,0 +1,64 @@ +# encoding: UTF-8 + +module TZInfo + module Format1 + # The format 1 TZInfo::Data country index file includes + # {Format1::CountryIndexDefinition}, which provides a + # {CountryIndexDefinition::ClassMethods#country country} method used to + # define each country in the index. + # + # @private + module CountryIndexDefinition #:nodoc: + # Adds class methods to the includee and initializes class instance + # variables. + # + # @param base [Module] the includee. + def self.append_features(base) + super + base.extend(ClassMethods) + base.instance_eval { @countries = {} } + end + + # Class methods for inclusion. + # + # @private + module ClassMethods #:nodoc: + # @return [Hash] a frozen `Hash` + # of all the countries that have been defined in the index keyed by + # their codes. + def countries + @description_deduper = nil + @countries.freeze + end + + private + + # Defines a country with an ISO 3166-1 alpha-2 country code and name. + # + # @param code [String] the ISO 3166-1 alpha-2 country code. + # @param name [String] the name of the country. + # @yield [definer] (optional) to obtain the time zones for the country. + # @yieldparam definer [CountryDefiner] a {CountryDefiner} instance. + def country(code, name) + @description_deduper ||= StringDeduper.new + + zones = if block_given? + definer = CountryDefiner.new(StringDeduper.global, @description_deduper) + yield definer + definer.timezones + else + [] + end + + @countries[code.freeze] = DataSources::CountryInfo.new(code, name, zones) + end + end + end + end + + # Alias used by TZInfo::Data format1 releases. + # + # @private + CountryIndexDefinition = Format1::CountryIndexDefinition #:nodoc: + private_constant :CountryIndexDefinition +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1/timezone_definer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1/timezone_definer.rb new file mode 100644 index 0000000000..578e4ea864 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1/timezone_definer.rb @@ -0,0 +1,64 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + module Format1 + # Instances of {Format1::TimezoneDefiner} are yielded to TZInfo::Data + # format 1 modules by {TimezoneDefinition} to allow the offsets and + # transitions of the time zone to be specified. + # + # @private + class TimezoneDefiner < Format2::TimezoneDefiner #:nodoc: + undef_method :subsequent_rules + + # Defines an offset. + # + # @param id [Symbol] an arbitrary value used identify the offset in + # subsequent calls to transition. It must be unique. + # @param utc_offset [Integer] the base offset from UTC of the zone in + # seconds. This does not include daylight savings time. + # @param std_offset [Integer] the daylight savings offset from the base + # offset in seconds. Typically either 0 or 3600. + # @param abbreviation [Symbol] an abbreviation for the offset, for + # example, `:EST` or `:EDT`. + # @raise [ArgumentError] if another offset has already been defined with + # the given id. + def offset(id, utc_offset, std_offset, abbreviation) + super(id, utc_offset, std_offset, abbreviation.to_s) + end + + # Defines a transition to a given offset. + # + # Transitions must be defined in increasing time order. + # + # @param year [Integer] the UTC year in which the transition occurs. Used + # in earlier versions of TZInfo, but now ignored. + # @param month [Integer] the UTC month in which the transition occurs. + # Used in earlier versions of TZInfo, but now ignored. + # @param offset_id [Symbol] references the id of a previously defined + # offset (see #offset). + # @param timestamp_value [Integer] the time the transition occurs as an + # Integer number of seconds since 1970-01-01 00:00:00 UTC ignoring leap + # seconds (i.e. each day is treated as if it were 86,400 seconds long). + # @param datetime_numerator [Integer] the time of the transition as the + # numerator of the `Rational` returned by `DateTime#ajd`. Used in + # earlier versions of TZInfo, but now ignored. + # @param datetime_denominator [Integer] the time of the transition as the + # denominator of the `Rational` returned by `DateTime#ajd`. Used in + # earlier versions of TZInfo, but now ignored. + # @raise [ArgumentError] if `offset_id` does not reference a defined + # offset. + # @raise [ArgumentError] if `timestamp_value` is not greater than the + # `timestamp_value` of the previously defined transition. + # @raise [ArgumentError] if `datetime_numerator` is specified, but + # `datetime_denominator` is not. In older versions of TZInfo, it was + # possible to define a transition with the `DateTime` numerator as the + # 4th parameter and the denominator as the 5th parameter. This style of + # definition is not used in released versions of TZInfo::Data. + def transition(year, month, offset_id, timestamp_value, datetime_numerator = nil, datetime_denominator = nil) + raise ArgumentError, 'DateTime-only transitions are not supported' if datetime_numerator && !datetime_denominator + super(offset_id, timestamp_value) + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1/timezone_definition.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1/timezone_definition.rb new file mode 100644 index 0000000000..4acf9a0b4a --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1/timezone_definition.rb @@ -0,0 +1,39 @@ +# encoding: UTF-8 + +module TZInfo + module Format1 + # {Format1::TimezoneDefinition} is included into format 1 time zone + # definition modules and provides the methods for defining time zones. + # + # @private + module TimezoneDefinition #:nodoc: + # Adds class methods to the includee. + # + # @param base [Module] the includee. + def self.append_features(base) + super + base.extend(Format2::TimezoneDefinition::ClassMethods) + base.extend(ClassMethods) + end + + # Class methods for inclusion. + # + # @private + module ClassMethods #:nodoc: + private + + # @return the class to be instantiated and yielded by + # {Format2::TimezoneDefinition::ClassMethods#timezone}. + def timezone_definer_class + TimezoneDefiner + end + end + end + end + + # Alias used by TZInfo::Data format1 releases. + # + # @private + TimezoneDefinition = Format1::TimezoneDefinition #:nodoc: + private_constant :TimezoneDefinition +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1/timezone_index_definition.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1/timezone_index_definition.rb new file mode 100644 index 0000000000..5d4518aa40 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format1/timezone_index_definition.rb @@ -0,0 +1,77 @@ +# encoding: UTF-8 + +module TZInfo + module Format1 + # The format 1 TZInfo::Data time zone index file includes + # {Format1::TimezoneIndexDefinition}, which provides methods used to define + # time zones in the index. + # + # @private + module TimezoneIndexDefinition #:nodoc: + # Adds class methods to the includee and initializes class instance + # variables. + # + # @param base [Module] the includee. + def self.append_features(base) + super + base.extend(ClassMethods) + base.instance_eval do + @timezones = [] + @data_timezones = [] + @linked_timezones = [] + end + end + + # Class methods for inclusion. + # + # @private + module ClassMethods #:nodoc: + # @return [Array] a frozen `Array` containing the identifiers of + # all data time zones. Identifiers are sorted according to + # `String#<=>`. + def data_timezones + unless @data_timezones.frozen? + @data_timezones = @data_timezones.sort.freeze + end + @data_timezones + end + + # @return [Array] a frozen `Array` containing the identifiers of + # all linked time zones. Identifiers are sorted according to + # `String#<=>`. + def linked_timezones + unless @linked_timezones.frozen? + @linked_timezones = @linked_timezones.sort.freeze + end + @linked_timezones + end + + private + + # Adds a data time zone to the index. + # + # @param identifier [String] the time zone identifier. + def timezone(identifier) + identifier = StringDeduper.global.dedupe(identifier) + @timezones << identifier + @data_timezones << identifier + end + + # Adds a linked time zone to the index. + # + # @param identifier [String] the time zone identifier. + def linked_timezone(identifier) + identifier = StringDeduper.global.dedupe(identifier) + @timezones << identifier + @linked_timezones << identifier + end + end + end + end + + # Alias used by TZInfo::Data format 1 releases. + # + # @private + TimezoneIndexDefinition = Format1::TimezoneIndexDefinition #:nodoc: + private_constant :TimezoneIndexDefinition +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2.rb new file mode 100644 index 0000000000..f7c63167d2 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2.rb @@ -0,0 +1,10 @@ +# encoding: UTF-8 + +module TZInfo + # Modules and classes used by the format 2 version of TZInfo::Data. + # + # @private + module Format2 #:nodoc: + end + private_constant :Format2 +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/country_definer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/country_definer.rb new file mode 100644 index 0000000000..158e3ec1bb --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/country_definer.rb @@ -0,0 +1,68 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + module Format2 + # Instances of {Format2::CountryDefiner} are yielded to the format 2 version + # of `TZInfo::Data::Indexes::Countries` by {CountryIndexDefiner} to allow + # the zones of a country to be specified. + # + # @private + class CountryDefiner #:nodoc: + # @return [Array] the time zones observed in the country. + attr_reader :timezones + + # Initializes a new {CountryDefiner}. + # + # @param shared_timezones [Hash] a `Hash` + # containing time zones shared by more than one country, keyed by a + # unique reference. + # @param identifier_deduper [StringDeduper] a {StringDeduper} instance to + # use when deduping time zone identifiers. + # @param description_deduper [StringDeduper] a {StringDeduper} instance to + # use when deduping time zone descriptions. + def initialize(shared_timezones, identifier_deduper, description_deduper) + @shared_timezones = shared_timezones + @identifier_deduper = identifier_deduper + @description_deduper = description_deduper + @timezones = [] + end + + # @overload timezone(reference) + # Defines a time zone of a country as a reference to a pre-defined + # shared time zone. + # @param reference [Symbol] a reference for a pre-defined shared time + # zone. + # @overload timezone(identifier, latitude_numerator, latitude_denominator, longitude_numerator, longitude_denominator, description) + # Defines a (non-shared) time zone of a country. The latitude and + # longitude are given as the numerator and denominator of a `Rational`. + # @param identifier [String] the time zone identifier. + # @param latitude_numerator [Integer] the numerator of the latitude. + # @param latitude_denominator [Integer] the denominator of the latitude. + # @param longitude_numerator [Integer] the numerator of the longitude. + # @param longitude_denominator [Integer] the denominator of the + # longitude. + # @param description [String] an optional description for the time zone. + def timezone(identifier_or_reference, latitude_numerator = nil, + latitude_denominator = nil, longitude_numerator = nil, + longitude_denominator = nil, description = nil) + if latitude_numerator + unless latitude_denominator && longitude_numerator && longitude_denominator + raise ArgumentError, 'Either just a reference should be supplied, or the identifier, latitude and longitude must all be specified' + end + + # Dedupe non-frozen literals from format 1 on all Ruby versions and + # format 2 on Ruby < 2.3 (without frozen_string_literal support). + + @timezones << CountryTimezone.new(@identifier_deduper.dedupe(identifier_or_reference), + Rational(latitude_numerator, latitude_denominator), + Rational(longitude_numerator, longitude_denominator), description && @description_deduper.dedupe(description)) + else + shared_timezone = @shared_timezones[identifier_or_reference] + raise ArgumentError, "Unknown shared timezone: #{identifier_or_reference}" unless shared_timezone + @timezones << shared_timezone + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/country_index_definer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/country_index_definer.rb new file mode 100644 index 0000000000..be28095e0c --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/country_index_definer.rb @@ -0,0 +1,68 @@ +# encoding: UTF-8 + +module TZInfo + module Format2 + # Instances of {Format2::CountryIndexDefiner} are yielded to the format 2 + # version of `TZInfo::Data::Indexes::Countries` by {CountryIndexDefinition} + # to allow countries and their time zones to be specified. + # + # @private + class CountryIndexDefiner #:nodoc: + # @return [Hash] a `Hash` of all the countries that + # have been defined in the index keyed by their codes. + attr_reader :countries + + # Initializes a new {CountryIndexDefiner}. + # + # @param identifier_deduper [StringDeduper] a {StringDeduper} instance to + # use when deduping time zone identifiers. + # @param description_deduper [StringDeduper] a {StringDeduper} instance to + # use when deduping time zone descriptions. + def initialize(identifier_deduper, description_deduper) + @identifier_deduper = identifier_deduper + @description_deduper = description_deduper + @shared_timezones = {} + @countries = {} + end + + # Defines a time zone shared by many countries with an reference for + # subsequent use in country definitions. The latitude and longitude are + # given as the numerator and denominator of a `Rational`. + # + # @param reference [Symbol] a unique reference for the time zone. + # @param identifier [String] the time zone identifier. + # @param latitude_numerator [Integer] the numerator of the latitude. + # @param latitude_denominator [Integer] the denominator of the latitude. + # @param longitude_numerator [Integer] the numerator of the longitude. + # @param longitude_denominator [Integer] the denominator of the longitude. + # @param description [String] an optional description for the time zone. + def timezone(reference, identifier, latitude_numerator, latitude_denominator, + longitude_numerator, longitude_denominator, description = nil) + # Dedupe non-frozen literals from format 1 on all Ruby versions and + # format 2 on Ruby < 2.3 (without frozen_string_literal support). + @shared_timezones[reference] = CountryTimezone.new(@identifier_deduper.dedupe(identifier), + Rational(latitude_numerator, latitude_denominator), + Rational(longitude_numerator, longitude_denominator), description && @description_deduper.dedupe(description)) + end + + # Defines a country. + # + # @param code [String] The ISO 3166-1 alpha-2 code of the country. + # @param name [String] Then name of the country. + # @yield [definer] yields (optional) to obtain the time zones for the + # country. + # @yieldparam definer [CountryDefiner] a {CountryDefiner} + # instance that should be used to specify the time zones of the country. + def country(code, name) + timezones = if block_given? + definer = CountryDefiner.new(@shared_timezones, @identifier_deduper, @description_deduper) + yield definer + definer.timezones + else + [] + end + @countries[code.freeze] = DataSources::CountryInfo.new(code, name, timezones) + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/country_index_definition.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/country_index_definition.rb new file mode 100644 index 0000000000..82b2127bcd --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/country_index_definition.rb @@ -0,0 +1,46 @@ +# encoding: UTF-8 + +module TZInfo + module Format2 + # The format 2 country index file includes + # {Format2::CountryIndexDefinition}, which provides a + # {CountryIndexDefinition::ClassMethods#country_index country_index} method + # used to define the country index. + # + # @private + module CountryIndexDefinition #:nodoc: + # Adds class methods to the includee and initializes class instance + # variables. + # + # @param base [Module] the includee. + def self.append_features(base) + super + base.extend(ClassMethods) + base.instance_eval { @countries = {}.freeze } + end + + # Class methods for inclusion. + # + # @private + module ClassMethods #:nodoc: + # @return [Hash] a frozen `Hash` + # of all the countries that have been defined in the index keyed by + # their codes. + attr_reader :countries + + private + + # Defines the index. + # + # @yield [definer] yields to allow the index to be defined. + # @yieldparam definer [CountryIndexDefiner] a {CountryIndexDefiner} + # instance that should be used to define the index. + def country_index + definer = CountryIndexDefiner.new(StringDeduper.global, StringDeduper.new) + yield definer + @countries = definer.countries.freeze + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/timezone_definer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/timezone_definer.rb new file mode 100644 index 0000000000..3c43caabae --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/timezone_definer.rb @@ -0,0 +1,94 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + module Format2 + # Instances of {TimezoneDefiner} are yielded to TZInfo::Data modules by + # {TimezoneDefinition} to allow the offsets and transitions of the time zone + # to be specified. + # + # @private + class TimezoneDefiner #:nodoc: + # @return [Array] the defined transitions of the time + # zone. + attr_reader :transitions + + # Initializes a new TimezoneDefiner. + # + # @param string_deduper [StringDeduper] a {StringDeduper} instance to use + # when deduping abbreviations. + def initialize(string_deduper) + @string_deduper = string_deduper + @offsets = {} + @transitions = [] + end + + # Returns the first offset to be defined or `nil` if no offsets have been + # defined. The first offset is observed before the time of the first + # transition. + # + # @return [TimezoneOffset] the first offset to be defined or `nil` if no + # offsets have been defined. + def first_offset + first = @offsets.first + first && first.last + end + + # Defines an offset. + # + # @param id [Symbol] an arbitrary value used identify the offset in + # subsequent calls to transition. It must be unique. + # @param base_utc_offset [Integer] the base offset from UTC of the zone in + # seconds. This does not include daylight savings time. + # @param std_offset [Integer] the daylight savings offset from the base + # offset in seconds. Typically either 0 or 3600. + # @param abbreviation [String] an abbreviation for the offset, for + # example, EST or EDT. + # @raise [ArgumentError] if another offset has already been defined with + # the given id. + def offset(id, base_utc_offset, std_offset, abbreviation) + raise ArgumentError, 'An offset has already been defined with the given id' if @offsets.has_key?(id) + + # Dedupe non-frozen literals from format 1 on all Ruby versions and + # format 2 on Ruby < 2.3 (without frozen_string_literal support). + abbreviation = @string_deduper.dedupe(abbreviation) + + offset = TimezoneOffset.new(base_utc_offset, std_offset, abbreviation) + @offsets[id] = offset + @previous_offset ||= offset + end + + # Defines a transition to a given offset. + # + # Transitions must be defined in increasing time order. + # + # @param offset_id [Symbol] references the id of a previously defined + # offset. + # @param timestamp_value [Integer] the time the transition occurs as a + # number of seconds since 1970-01-01 00:00:00 UTC ignoring leap seconds + # (i.e. each day is treated as if it were 86,400 seconds long). + # @raise [ArgumentError] if `offset_id` does not reference a defined + # offset. + # @raise [ArgumentError] if `timestamp_value` is not greater than the + # `timestamp_value` of the previously defined transition. + def transition(offset_id, timestamp_value) + offset = @offsets[offset_id] + raise ArgumentError, 'offset_id has not been defined' unless offset + raise ArgumentError, 'timestamp is not greater than the timestamp of the previously defined transition' if !@transitions.empty? && @transitions.last.timestamp_value >= timestamp_value + @transitions << TimezoneTransition.new(offset, @previous_offset, timestamp_value) + @previous_offset = offset + end + + # Defines the rules that will be used for handling instants after the last + # transition. + # + # This method is currently just a placeholder for forward compatibility + # that accepts and ignores any arguments passed. + # + # Support for subsequent rules will be added in a future version of TZInfo + # and the rules will be included in format 2 releases of TZInfo::Data. + def subsequent_rules(*args) + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/timezone_definition.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/timezone_definition.rb new file mode 100644 index 0000000000..216df90f16 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/timezone_definition.rb @@ -0,0 +1,73 @@ +# encoding: UTF-8 + +module TZInfo + module Format2 + # {Format2::TimezoneDefinition} is included into format 2 time zone + # definition modules and provides methods for defining time zones. + # + # @private + module TimezoneDefinition #:nodoc: + # Adds class methods to the includee. + # + # @param base [Module] the includee. + def self.append_features(base) + super + base.extend(ClassMethods) + end + + # Class methods for inclusion. + # + # @private + module ClassMethods #:nodoc: + # @return [TimezoneInfo] the last time zone to be defined. + def get + @timezone + end + + private + + # @return [Class] the class to be instantiated and yielded by + # {#timezone}. + def timezone_definer_class + TimezoneDefiner + end + + # Defines a data time zone. + # + # @param identifier [String] the identifier of the time zone. + # @yield [definer] yields to the caller to define the time zone. + # @yieldparam definer [Object] an instance of the class returned by + # {#timezone_definer_class}, typically {TimezoneDefiner}. + def timezone(identifier) + # Dedupe non-frozen literals from format 1 on all Ruby versions and + # format 2 on Ruby < 2.3 (without frozen_string_literal support). + string_deduper = StringDeduper.global + identifier = string_deduper.dedupe(identifier) + + definer = timezone_definer_class.new(string_deduper) + yield definer + transitions = definer.transitions + + @timezone = if transitions.empty? + DataSources::ConstantOffsetDataTimezoneInfo.new(identifier, definer.first_offset) + else + DataSources::TransitionsDataTimezoneInfo.new(identifier, transitions) + end + end + + # Defines a linked time zone. + # + # @param identifier [String] the identifier of the time zone being + # defined. + # @param link_to_identifier [String] the identifier the new time zone + # links to (is an alias for). + def linked_timezone(identifier, link_to_identifier) + # Dedupe non-frozen literals from format 1 on all Ruby versions and + # format 2 on Ruby < 2.3 (without frozen_string_literal support). + string_deduper = StringDeduper.global + @timezone = DataSources::LinkedTimezoneInfo.new(string_deduper.dedupe(identifier), string_deduper.dedupe(link_to_identifier)) + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/timezone_index_definer.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/timezone_index_definer.rb new file mode 100644 index 0000000000..f90e77682d --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/timezone_index_definer.rb @@ -0,0 +1,45 @@ +# encoding: UTF-8 + +module TZInfo + module Format2 + # Instances of {TimezoneIndexDefiner} are yielded by + # {TimezoneIndexDefinition} to allow the time zone index to be defined. + # + # @private + class TimezoneIndexDefiner #:nodoc: + # @return [Array] the identifiers of all data time zones. + attr_reader :data_timezones + + # @return [Array] the identifiers of all linked time zones. + attr_reader :linked_timezones + + # Initializes a new TimezoneDefiner. + # + # @param string_deduper [StringDeduper] a {StringDeduper} instance to use + # when deduping identifiers. + def initialize(string_deduper) + @string_deduper = string_deduper + @data_timezones = [] + @linked_timezones = [] + end + + # Adds a data time zone to the index. + # + # @param identifier [String] the time zone identifier. + def data_timezone(identifier) + # Dedupe non-frozen literals from format 1 on all Ruby versions and + # format 2 on Ruby < 2.3 (without frozen_string_literal support). + @data_timezones << @string_deduper.dedupe(identifier) + end + + # Adds a linked time zone to the index. + # + # @param identifier [String] the time zone identifier. + def linked_timezone(identifier) + # Dedupe non-frozen literals from format 1 on all Ruby versions and + # format 2 on Ruby < 2.3 (without frozen_string_literal support). + @linked_timezones << @string_deduper.dedupe(identifier) + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/timezone_index_definition.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/timezone_index_definition.rb new file mode 100644 index 0000000000..ceafd0cf1a --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/format2/timezone_index_definition.rb @@ -0,0 +1,55 @@ +# encoding: UTF-8 + +module TZInfo + module Format2 + # The format 2 time zone index file includes {TimezoneIndexDefinition}, + # which provides the {TimezoneIndexDefinition::ClassMethods#timezone_index + # timezone_index} method used to define the index. + # + # @private + module TimezoneIndexDefinition #:nodoc: + # Adds class methods to the includee and initializes class instance + # variables. + # + # @param base [Module] the includee. + def self.append_features(base) + super + base.extend(ClassMethods) + base.instance_eval do + empty = [].freeze + @timezones = empty + @data_timezones = empty + @linked_timezones = empty + end + end + + # Class methods for inclusion. + # + # @private + module ClassMethods #:nodoc: + # @return [Array] a frozen `Array` containing the identifiers of + # all data time zones. Identifiers are sorted according to + # `String#<=>`. + attr_reader :data_timezones + + # @return [Array] a frozen `Array` containing the identifiers of + # all linked time zones. Identifiers are sorted according to + # `String#<=>`. + attr_reader :linked_timezones + + # Defines the index. + # + # @yield [definer] yields to the caller to allow the index to be + # defined. + # @yieldparam definer [TimezoneIndexDefiner] a {TimezoneIndexDefiner} + # instance that should be used to define the index. + def timezone_index + definer = TimezoneIndexDefiner.new(StringDeduper.global) + yield definer + @data_timezones = definer.data_timezones.sort!.freeze + @linked_timezones = definer.linked_timezones.sort!.freeze + end + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/info_timezone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/info_timezone.rb new file mode 100644 index 0000000000..ff9dcfa137 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/info_timezone.rb @@ -0,0 +1,35 @@ +# encoding: UTF-8 + +module TZInfo + + # A {Timezone} based on a {DataSources::TimezoneInfo}. + # + # @abstract + class InfoTimezone < Timezone + # Initializes a new {InfoTimezone}. + # + # {InfoTimezone} instances should not normally be created directly. Use + # the {Timezone.get} method to obtain {Timezone} instances. + # + # @param info [DataSources::TimezoneInfo] a {DataSources::TimezoneInfo} + # instance supplied by a {DataSource} that will be used as the source of + # data for this {InfoTimezone}. + def initialize(info) + super() + @info = info + end + + # (see Timezone#identifier) + def identifier + @info.identifier + end + + protected + + # @return [DataSources::TimezoneInfo] the {DataSources::TimezoneInfo} this + # {InfoTimezone} is based on. + def info + @info + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/linked_timezone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/linked_timezone.rb new file mode 100644 index 0000000000..af800dc1ee --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/linked_timezone.rb @@ -0,0 +1,44 @@ +# encoding: UTF-8 + +module TZInfo + # Represents time zones that are defined as a link to or alias for another + # time zone. + class LinkedTimezone < InfoTimezone + # Initializes a new {LinkedTimezone}. + # + # {LinkedTimezone} instances should not normally be created directly. Use + # the {Timezone.get} method to obtain {Timezone} instances. + # + # @param info [DataSources::LinkedTimezoneInfo] a + # {DataSources::LinkedTimezoneInfo} instance supplied by a {DataSource} + # that will be used as the source of data for this {LinkedTimezone}. + def initialize(info) + super + @linked_timezone = Timezone.get(info.link_to_identifier) + end + + # (see Timezone#period_for) + def period_for(time) + @linked_timezone.period_for(time) + end + + # (see Timezone#periods_for_local) + def periods_for_local(local_time) + @linked_timezone.periods_for_local(local_time) + end + + # (see Timezone#transitions_up_to) + def transitions_up_to(to, from = nil) + @linked_timezone.transitions_up_to(to, from) + end + + # Returns the canonical {Timezone} instance for this {LinkedTimezone}. + # + # For a {LinkedTimezone}, this is the canonical zone of the link target. + # + # @return [Timezone] the canonical {Timezone} instance for this {Timezone}. + def canonical_zone + @linked_timezone.canonical_zone + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/offset_timezone_period.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/offset_timezone_period.rb new file mode 100644 index 0000000000..a5988e0714 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/offset_timezone_period.rb @@ -0,0 +1,42 @@ +# encoding: UTF-8 + +module TZInfo + # Represents the infinite period of time in a time zone that constantly + # observes the same offset from UTC (has an unbounded start and end). + class OffsetTimezonePeriod < TimezonePeriod + # Initializes an {OffsetTimezonePeriod}. + # + # @param offset [TimezoneOffset] the offset that is constantly observed. + # @raise [ArgumentError] if `offset` is `nil`. + def initialize(offset) + super + end + + # @return [TimezoneTransition] the transition that defines the start of this + # {TimezonePeriod}, always `nil` for {OffsetTimezonePeriod}. + def start_transition + nil + end + + # @return [TimezoneTransition] the transition that defines the end of this + # {TimezonePeriod}, always `nil` for {OffsetTimezonePeriod}. + def end_transition + nil + end + + # Determines if this {OffsetTimezonePeriod} is equal to another instance. + # + # @param p [Object] the instance to test for equality. + # @return [Boolean] `true` if `p` is a {OffsetTimezonePeriod} with the same + # {offset}, otherwise `false`. + def ==(p) + p.kind_of?(OffsetTimezonePeriod) && offset == p.offset + end + alias eql? == + + # @return [Integer] a hash based on {offset}. + def hash + offset.hash + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/string_deduper.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/string_deduper.rb new file mode 100644 index 0000000000..e07fa10ac5 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/string_deduper.rb @@ -0,0 +1,118 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +require 'concurrent' + +module TZInfo + # Maintains a pool of `String` instances. The {#dedupe} method will return + # either a pooled copy of a given `String` or add the instance to the pool. + # + # @private + class StringDeduper #:nodoc: + class << self + # @return [StringDeduper] a globally available singleton instance of + # {StringDeduper}. This instance is safe for use in concurrently + # executing threads. + attr_reader :global + end + + # Initializes a new {StringDeduper}. + def initialize + @strings = create_hash do |h, k| + v = k.dup.freeze + h[v] = v + end + end + + # @param string [String] the string to deduplicate. + # @return [bool] `string` if it is frozen, otherwise a frozen, possibly + # pre-existing copy of `string`. + def dedupe(string) + return string if string.frozen? + @strings[string] + end + + protected + + # Creates a `Hash` to store pooled `String` instances. + # + # @param block [Proc] Default value block to be passed to `Hash.new`. + # @return [Hash] a `Hash` to store pooled `String` instances. + def create_hash(&block) + Hash.new(&block) + end + end + private_constant :StringDeduper + + # A thread-safe version of {StringDeduper}. + # + # @private + class ConcurrentStringDeduper < StringDeduper #:nodoc: + protected + + def create_hash(&block) + Concurrent::Map.new(&block) + end + end + private_constant :ConcurrentStringDeduper + + + string_unary_minus_does_dedupe = if '0'.respond_to?(:-@) + # :nocov_no_string_-@: + s1 = -('0'.dup) + s2 = -('0'.dup) + s1.object_id == s2.object_id + # :nocov_no_string_-@: + else + # :nocov_string_-@: + false + # :nocov_string_-@: + end + + if string_unary_minus_does_dedupe + # :nocov_no_deduping_string_unary_minus: + + # An implementation of {StringDeduper} using the `String#-@` method where + # that method performs deduplication (Ruby 2.5 and later). + # + # Note that this is slightly different to the plain {StringDeduper} + # implementation. In this implementation, frozen literal strings are already + # in the pool and are candidates for being returned, even when passed + # another equal frozen non-literal string. {StringDeduper} will always + # return frozen strings. + # + # There are also differences in encoding handling. This implementation will + # treat strings with different encodings as different strings. + # {StringDeduper} will treat strings with the compatible encodings as the + # same string. + # + # @private + class UnaryMinusGlobalStringDeduper #:nodoc: + # @param string [String] the string to deduplicate. + # @return [bool] `string` if it is frozen, otherwise a frozen, possibly + # pre-existing copy of `string`. + def dedupe(string) + # String#-@ on Ruby 2.6 will dedupe a frozen non-literal String. Ruby + # 2.5 will just return frozen strings. + # + # The pooled implementation can't tell the difference between frozen + # literals and frozen non-literals, so must always return frozen String + # instances to avoid doing unncessary work when loading format 2 + # TZInfo::Data modules. + # + # For compatibility with the pooled implementation, just return frozen + # string instances (acting like Ruby 2.5). + return string if string.frozen? + -string + end + end + private_constant :UnaryMinusGlobalStringDeduper + + StringDeduper.instance_variable_set(:@global, UnaryMinusGlobalStringDeduper.new) + # :nocov_no_deduping_string_unary_minus: + else + # :nocov_deduping_string_unary_minus: + StringDeduper.instance_variable_set(:@global, ConcurrentStringDeduper.new) + # :nocov_deduping_string_unary_minus: + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/time_with_offset.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/time_with_offset.rb new file mode 100644 index 0000000000..6b9bebb085 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/time_with_offset.rb @@ -0,0 +1,154 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + # A subclass of `Time` used to represent local times. {TimeWithOffset} holds a + # reference to the related {TimezoneOffset} and overrides various methods to + # return results appropriate for the {TimezoneOffset}. Certain operations will + # clear the associated {TimezoneOffset} (if the {TimezoneOffset} would not + # necessarily be valid for the result). Once the {TimezoneOffset} has been + # cleared, {TimeWithOffset} behaves identically to `Time`. + # + # Arithmetic performed on {TimeWithOffset} instances is _not_ time zone-aware. + # Regardless of whether transitions in the time zone are crossed, results of + # arithmetic operations will always maintain the same offset from UTC + # (`utc_offset`). The associated {TimezoneOffset} will aways be cleared. + class TimeWithOffset < Time + include WithOffset + + # @return [TimezoneOffset] the {TimezoneOffset} associated with this + # instance. + attr_reader :timezone_offset + + # Marks this {TimeWithOffset} as a local time with the UTC offset of a given + # {TimezoneOffset} and sets the associated {TimezoneOffset}. + # + # @param timezone_offset [TimezoneOffset] the {TimezoneOffset} to use to set + # the offset of this {TimeWithOffset}. + # @return [TimeWithOffset] `self`. + # @raise [ArgumentError] if `timezone_offset` is `nil`. + def set_timezone_offset(timezone_offset) + raise ArgumentError, 'timezone_offset must be specified' unless timezone_offset + localtime(timezone_offset.observed_utc_offset) + @timezone_offset = timezone_offset + self + end + + # An overridden version of `Time#dst?` that, if there is an associated + # {TimezoneOffset}, returns the result of calling {TimezoneOffset#dst? dst?} + # on that offset. + # + # @return [Boolean] `true` if daylight savings time is being observed, + # otherwise `false`. + def dst? + to = timezone_offset + to ? to.dst? : super + end + alias isdst dst? + + # An overridden version of `Time#getlocal` that clears the associated + # {TimezoneOffset} if the base implementation of `getlocal` returns a + # {TimeWithOffset}. + # + # @return [Time] a representation of the {TimeWithOffset} using either the + # local time zone or the given offset. + def getlocal(*args) + # JRuby < 9.3 returns a Time in all cases. + # JRuby >= 9.3 returns a Time when called with no arguments and a + # TimeWithOffset with a timezone_offset assigned when called with an + # offset argument. + result = super + result.clear_timezone_offset if result.kind_of?(TimeWithOffset) + result + end + + # An overridden version of `Time#gmtime` that clears the associated + # {TimezoneOffset}. + # + # @return [TimeWithOffset] `self`. + def gmtime + super + @timezone_offset = nil + self + end + + # An overridden version of `Time#localtime` that clears the associated + # {TimezoneOffset}. + # + # @return [TimeWithOffset] `self`. + def localtime(*args) + super + @timezone_offset = nil + self + end + + # An overridden version of `Time#round` that, if there is an associated + # {TimezoneOffset}, returns a {TimeWithOffset} preserving that offset. + # + # @return [Time] the rounded time. + def round(ndigits = 0) + if_timezone_offset(super) {|o,t| self.class.at(t.to_i, t.subsec * 1_000_000).set_timezone_offset(o) } + end + + # An overridden version of `Time#to_a`. The `isdst` (index 8) and `zone` + # (index 9) elements of the array are set according to the associated + # {TimezoneOffset}. + # + # @return [Array] an `Array` representation of the {TimeWithOffset}. + def to_a + if_timezone_offset(super) do |o,a| + a[8] = o.dst? + a[9] = o.abbreviation + a + end + end + + # An overridden version of `Time#utc` that clears the associated + # {TimezoneOffset}. + # + # @return [TimeWithOffset] `self`. + def utc + super + @timezone_offset = nil + self + end + + # An overridden version of `Time#zone` that, if there is an associated + # {TimezoneOffset}, returns the {TimezoneOffset#abbreviation abbreviation} + # of that offset. + # + # @return [String] the {TimezoneOffset#abbreviation abbreviation} of the + # associated {TimezoneOffset}, or the result from `Time#zone` if there is + # no such offset. + def zone + to = timezone_offset + to ? to.abbreviation : super + end + + # An overridden version of `Time#to_datetime` that, if there is an + # associated {TimezoneOffset}, returns a {DateTimeWithOffset} with that + # offset. + # + # @return [DateTime] if there is an associated {TimezoneOffset}, a + # {DateTimeWithOffset} representation of this {TimeWithOffset}, otherwise + # a `Time` representation. + def to_datetime + if_timezone_offset(super) do |o,dt| + offset = dt.offset + result = DateTimeWithOffset.jd(dt.jd + dt.day_fraction - offset) + result = result.new_offset(offset) unless offset == 0 + result.set_timezone_offset(o) + end + end + + protected + + # Clears the associated {TimezoneOffset}. + # + # @return [TimeWithOffset] `self`. + def clear_timezone_offset + @timezone_offset = nil + self + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timestamp.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timestamp.rb new file mode 100644 index 0000000000..5ab44f7848 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timestamp.rb @@ -0,0 +1,548 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + # A time represented as an `Integer` number of seconds since 1970-01-01 + # 00:00:00 UTC (ignoring leap seconds), the fraction through the second + # (sub_second as a `Rational`) and an optional UTC offset. Like Ruby's `Time` + # class, {Timestamp} can distinguish between a local time with a zero offset + # and a time specified explicitly as UTC. + class Timestamp + include Comparable + + # The Unix epoch (1970-01-01 00:00:00 UTC) as a chronological Julian day + # number. + JD_EPOCH = 2440588 + private_constant :JD_EPOCH + + class << self + # Returns a new {Timestamp} representing the (Gregorian calendar) date and + # time specified by the supplied parameters. + # + # If `utc_offset` is `nil`, `:utc` or 0, the date and time parameters will + # be interpreted as representing a UTC date and time. Otherwise the date + # and time parameters will be interpreted as a local date and time with + # the given offset. + # + # @param year [Integer] the year. + # @param month [Integer] the month (1-12). + # @param day [Integer] the day of the month (1-31). + # @param hour [Integer] the hour (0-23). + # @param minute [Integer] the minute (0-59). + # @param second [Integer] the second (0-59). + # @param sub_second [Numeric] the fractional part of the second as either + # a `Rational` that is greater than or equal to 0 and less than 1, or + # the `Integer` 0. + # @param utc_offset [Object] either `nil` for a {Timestamp} without a + # specified offset, an offset from UTC specified as an `Integer` number + # of seconds or the `Symbol` `:utc`). + # @return [Timestamp] a new {Timestamp} representing the specified + # (Gregorian calendar) date and time. + # @raise [ArgumentError] if either of `year`, `month`, `day`, `hour`, + # `minute`, or `second` is not an `Integer`. + # @raise [ArgumentError] if `sub_second` is not a `Rational`, or the + # `Integer` 0. + # @raise [ArgumentError] if `utc_offset` is not `nil`, not an `Integer` + # and not the `Symbol` `:utc`. + # @raise [RangeError] if `month` is not between 1 and 12. + # @raise [RangeError] if `day` is not between 1 and 31. + # @raise [RangeError] if `hour` is not between 0 and 23. + # @raise [RangeError] if `minute` is not between 0 and 59. + # @raise [RangeError] if `second` is not between 0 and 59. + # @raise [RangeError] if `sub_second` is a `Rational` but that is less + # than 0 or greater than or equal to 1. + def create(year, month = 1, day = 1, hour = 0, minute = 0, second = 0, sub_second = 0, utc_offset = nil) + raise ArgumentError, 'year must be an Integer' unless year.kind_of?(Integer) + raise ArgumentError, 'month must be an Integer' unless month.kind_of?(Integer) + raise ArgumentError, 'day must be an Integer' unless day.kind_of?(Integer) + raise ArgumentError, 'hour must be an Integer' unless hour.kind_of?(Integer) + raise ArgumentError, 'minute must be an Integer' unless minute.kind_of?(Integer) + raise ArgumentError, 'second must be an Integer' unless second.kind_of?(Integer) + raise RangeError, 'month must be between 1 and 12' if month < 1 || month > 12 + raise RangeError, 'day must be between 1 and 31' if day < 1 || day > 31 + raise RangeError, 'hour must be between 0 and 23' if hour < 0 || hour > 23 + raise RangeError, 'minute must be between 0 and 59' if minute < 0 || minute > 59 + raise RangeError, 'second must be between 0 and 59' if second < 0 || second > 59 + + # Based on days_from_civil from https://howardhinnant.github.io/date_algorithms.html#days_from_civil + after_february = month > 2 + year -= 1 unless after_february + era = year / 400 + year_of_era = year - era * 400 + day_of_year = (153 * (month + (after_february ? -3 : 9)) + 2) / 5 + day - 1 + day_of_era = year_of_era * 365 + year_of_era / 4 - year_of_era / 100 + day_of_year + days_since_epoch = era * 146097 + day_of_era - 719468 + value = ((days_since_epoch * 24 + hour) * 60 + minute) * 60 + second + value -= utc_offset if utc_offset.kind_of?(Integer) + + new(value, sub_second, utc_offset) + end + + # When used without a block, returns a {Timestamp} representation of a + # given `Time`, `DateTime` or {Timestamp}. + # + # When called with a block, the {Timestamp} representation of `value` is + # passed to the block. The block must then return a {Timestamp}, which + # will be converted back to the type of the initial value. If the initial + # value was a {Timestamp}, the block result will just be returned. + # + # The UTC offset of `value` can either be preserved (the {Timestamp} + # representation will have the same UTC offset as `value`), ignored (the + # {Timestamp} representation will have no defined UTC offset), or treated + # as though it were UTC (the {Timestamp} representation will have a + # {utc_offset} of 0 and {utc?} will return `true`). + # + # @param value [Object] a `Time`, `DateTime` or {Timestamp}. + # @param offset [Symbol] either `:preserve` to preserve the offset of + # `value`, `:ignore` to ignore the offset of `value` and create a + # {Timestamp} with an unspecified offset, or `:treat_as_utc` to treat + # the offset of `value` as though it were UTC and create a UTC + # {Timestamp}. + # @yield [timestamp] if a block is provided, the {Timestamp} + # representation is passed to the block. + # @yieldparam timestamp [Timestamp] the {Timestamp} representation of + # `value`. + # @yieldreturn [Timestamp] a {Timestamp} to be converted back to the type + # of `value`. + # @return [Object] if called without a block, the {Timestamp} + # representation of `value`, otherwise the result of the block, + # converted back to the type of `value`. + def for(value, offset = :preserve) + raise ArgumentError, 'value must be specified' unless value + + case offset + when :ignore + ignore_offset = true + target_utc_offset = nil + when :treat_as_utc + ignore_offset = true + target_utc_offset = :utc + when :preserve + ignore_offset = false + target_utc_offset = nil + else + raise ArgumentError, 'offset must be :preserve, :ignore or :treat_as_utc' + end + + time_like = false + timestamp = case value + when Time + for_time(value, ignore_offset, target_utc_offset) + when DateTime + for_datetime(value, ignore_offset, target_utc_offset) + when Timestamp + for_timestamp(value, ignore_offset, target_utc_offset) + else + raise ArgumentError, "#{value.class} values are not supported" unless is_time_like?(value) + time_like = true + for_time_like(value, ignore_offset, target_utc_offset) + end + + if block_given? + result = yield timestamp + raise ArgumentError, 'block must return a Timestamp' unless result.kind_of?(Timestamp) + + case value + when Time + result.to_time + when DateTime + result.to_datetime + else # A Time-like value or a Timestamp + time_like ? result.to_time : result + end + else + timestamp + end + end + + # Creates a new UTC {Timestamp}. + # + # @param value [Integer] the number of seconds since 1970-01-01 00:00:00 + # UTC ignoring leap seconds. + # @param sub_second [Numeric] the fractional part of the second as either + # a `Rational` that is greater than or equal to 0 and less than 1, or + # the `Integer` 0. + # @raise [ArgumentError] if `value` is not an `Integer`. + # @raise [ArgumentError] if `sub_second` is not a `Rational`, or the + # `Integer` 0. + # @raise [RangeError] if `sub_second` is a `Rational` but that is less + # than 0 or greater than or equal to 1. + def utc(value, sub_second = 0) + new(value, sub_second, :utc) + end + + private + + # Constructs a new instance of `self` (i.e. {Timestamp} or a subclass of + # {Timestamp}) without validating the parameters. This method is used + # internally within {Timestamp} to avoid the overhead of checking + # parameters. + # + # @param value [Integer] the number of seconds since 1970-01-01 00:00:00 + # UTC ignoring leap seconds. + # @param sub_second [Numeric] the fractional part of the second as either + # a `Rational` that is greater than or equal to 0 and less than 1, or + # the `Integer` 0. + # @param utc_offset [Object] either `nil` for a {Timestamp} without a + # specified offset, an offset from UTC specified as an `Integer` number + # of seconds or the `Symbol` `:utc`). + # @return [Timestamp] a new instance of `self`. + def new!(value, sub_second = 0, utc_offset = nil) + result = allocate + result.send(:initialize!, value, sub_second, utc_offset) + result + end + + # Creates a {Timestamp} that represents a given `Time`, optionally + # ignoring the offset. + # + # @param time [Time] a `Time`. + # @param ignore_offset [Boolean] whether to ignore the offset of `time`. + # @param target_utc_offset [Object] if `ignore_offset` is `true`, the UTC + # offset of the result (`:utc`, `nil` or an `Integer`). + # @return [Timestamp] the {Timestamp} representation of `time`. + def for_time(time, ignore_offset, target_utc_offset) + value = time.to_i + sub_second = time.subsec + + if ignore_offset + utc_offset = target_utc_offset + value += time.utc_offset + elsif time.utc? + utc_offset = :utc + else + utc_offset = time.utc_offset + end + + new!(value, sub_second, utc_offset) + end + + # Creates a {Timestamp} that represents a given `DateTime`, optionally + # ignoring the offset. + # + # @param datetime [DateTime] a `DateTime`. + # @param ignore_offset [Boolean] whether to ignore the offset of + # `datetime`. + # @param target_utc_offset [Object] if `ignore_offset` is `true`, the UTC + # offset of the result (`:utc`, `nil` or an `Integer`). + # @return [Timestamp] the {Timestamp} representation of `datetime`. + def for_datetime(datetime, ignore_offset, target_utc_offset) + value = (datetime.jd - JD_EPOCH) * 86400 + datetime.sec + datetime.min * 60 + datetime.hour * 3600 + sub_second = datetime.sec_fraction + + if ignore_offset + utc_offset = target_utc_offset + else + utc_offset = (datetime.offset * 86400).to_i + value -= utc_offset + end + + new!(value, sub_second, utc_offset) + end + + # Returns a {Timestamp} that represents another {Timestamp}, optionally + # ignoring the offset. If the result would be identical to `value`, the + # same instance is returned. If the passed in value is an instance of a + # subclass of {Timestamp}, then a new {Timestamp} will always be returned. + # + # @param timestamp [Timestamp] a {Timestamp}. + # @param ignore_offset [Boolean] whether to ignore the offset of + # `timestamp`. + # @param target_utc_offset [Object] if `ignore_offset` is `true`, the UTC + # offset of the result (`:utc`, `nil` or an `Integer`). + # @return [Timestamp] a [Timestamp] representation of `timestamp`. + def for_timestamp(timestamp, ignore_offset, target_utc_offset) + if ignore_offset + if target_utc_offset + unless target_utc_offset == :utc && timestamp.utc? || timestamp.utc_offset == target_utc_offset + return new!(timestamp.value + (timestamp.utc_offset || 0), timestamp.sub_second, target_utc_offset) + end + elsif timestamp.utc_offset + return new!(timestamp.value + timestamp.utc_offset, timestamp.sub_second) + end + end + + unless timestamp.instance_of?(Timestamp) + # timestamp is identical in value, sub_second and utc_offset but is a + # subclass (i.e. TimestampWithOffset). Return a new Timestamp + # instance. + return new!(timestamp.value, timestamp.sub_second, timestamp.utc? ? :utc : timestamp.utc_offset) + end + + timestamp + end + + # Determines if an object is like a `Time` (for the purposes of converting + # to a {Timestamp} with {for}), responding to `to_i` and `subsec`. + # + # @param value [Object] an object to test. + # @return [Boolean] `true` if the object is `Time`-like, otherwise + # `false`. + def is_time_like?(value) + value.respond_to?(:to_i) && value.respond_to?(:subsec) + end + + # Creates a {Timestamp} that represents a given `Time`-like object, + # optionally ignoring the offset (if the `time_like` responds to + # `utc_offset`). + # + # @param time_like [Object] a `Time`-like object. + # @param ignore_offset [Boolean] whether to ignore the offset of `time`. + # @param target_utc_offset [Object] if `ignore_offset` is `true`, the UTC + # offset of the result (`:utc`, `nil` or an `Integer`). + # @return [Timestamp] the {Timestamp} representation of `time_like`. + def for_time_like(time_like, ignore_offset, target_utc_offset) + value = time_like.to_i + sub_second = time_like.subsec.to_r + + if ignore_offset + utc_offset = target_utc_offset + value += time_like.utc_offset.to_i if time_like.respond_to?(:utc_offset) + elsif time_like.respond_to?(:utc_offset) + utc_offset = time_like.utc_offset.to_i + else + utc_offset = 0 + end + + new(value, sub_second, utc_offset) + end + end + + # @return [Integer] the number of seconds since 1970-01-01 00:00:00 UTC + # ignoring leap seconds (i.e. each day is treated as if it were 86,400 + # seconds long). + attr_reader :value + + # @return [Numeric] the fraction of a second elapsed since timestamp as + # either a `Rational` or the `Integer` 0. Always greater than or equal to + # 0 and less than 1. + attr_reader :sub_second + + # @return [Integer] the offset from UTC in seconds or `nil` if the + # {Timestamp} doesn't have a specified offset. + attr_reader :utc_offset + + # Initializes a new {Timestamp}. + # + # @param value [Integer] the number of seconds since 1970-01-01 00:00:00 UTC + # ignoring leap seconds. + # @param sub_second [Numeric] the fractional part of the second as either a + # `Rational` that is greater than or equal to 0 and less than 1, or + # the `Integer` 0. + # @param utc_offset [Object] either `nil` for a {Timestamp} without a + # specified offset, an offset from UTC specified as an `Integer` number of + # seconds or the `Symbol` `:utc`). + # @raise [ArgumentError] if `value` is not an `Integer`. + # @raise [ArgumentError] if `sub_second` is not a `Rational`, or the + # `Integer` 0. + # @raise [RangeError] if `sub_second` is a `Rational` but that is less + # than 0 or greater than or equal to 1. + # @raise [ArgumentError] if `utc_offset` is not `nil`, not an `Integer` and + # not the `Symbol` `:utc`. + def initialize(value, sub_second = 0, utc_offset = nil) + raise ArgumentError, 'value must be an Integer' unless value.kind_of?(Integer) + raise ArgumentError, 'sub_second must be a Rational or the Integer 0' unless (sub_second.kind_of?(Integer) && sub_second == 0) || sub_second.kind_of?(Rational) + raise RangeError, 'sub_second must be >= 0 and < 1' if sub_second < 0 || sub_second >= 1 + raise ArgumentError, 'utc_offset must be an Integer, :utc or nil' if utc_offset && utc_offset != :utc && !utc_offset.kind_of?(Integer) + initialize!(value, sub_second, utc_offset) + end + + # @return [Boolean] `true` if this {Timestamp} represents UTC, `false` if + # the {Timestamp} wasn't specified as UTC or `nil` if the {Timestamp} has + # no specified offset. + def utc? + @utc + end + + # Adds a number of seconds to the {Timestamp} value, setting the UTC offset + # of the result. + # + # @param seconds [Integer] the number of seconds to be added. + # @param utc_offset [Object] either `nil` for a {Timestamp} without a + # specified offset, an offset from UTC specified as an `Integer` number of + # seconds or the `Symbol` `:utc`). + # @return [Timestamp] the result of adding `seconds` to the + # {Timestamp} value as a new {Timestamp} instance with the chosen + # `utc_offset`. + # @raise [ArgumentError] if `seconds` is not an `Integer`. + # @raise [ArgumentError] if `utc_offset` is not `nil`, not an `Integer` and + # not the `Symbol` `:utc`. + def add_and_set_utc_offset(seconds, utc_offset) + raise ArgumentError, 'seconds must be an Integer' unless seconds.kind_of?(Integer) + raise ArgumentError, 'utc_offset must be an Integer, :utc or nil' if utc_offset && utc_offset != :utc && !utc_offset.kind_of?(Integer) + return self if seconds == 0 && utc_offset == (@utc ? :utc : @utc_offset) + Timestamp.send(:new!, @value + seconds, @sub_second, utc_offset) + end + + # @return [Timestamp] a UTC {Timestamp} equivalent to this instance. Returns + # `self` if {#utc? self.utc?} is `true`. + def utc + return self if @utc + Timestamp.send(:new!, @value, @sub_second, :utc) + end + + # Converts this {Timestamp} to a `Time`. + # + # @return [Time] a `Time` representation of this {Timestamp}. If the UTC + # offset of this {Timestamp} is not specified, a UTC `Time` will be + # returned. + def to_time + time = new_time + + if @utc_offset && !@utc + time.localtime(@utc_offset) + else + time.utc + end + end + + # Converts this {Timestamp} to a `DateTime`. + # + # @return [DateTime] a DateTime representation of this {Timestamp}. If the + # UTC offset of this {Timestamp} is not specified, a UTC `DateTime` will + # be returned. + def to_datetime + new_datetime + end + + # Converts this {Timestamp} to an `Integer` number of seconds since + # 1970-01-01 00:00:00 UTC (ignoring leap seconds). + # + # @return [Integer] an Integer representation of this {Timestamp} (the + # number of seconds since 1970-01-01 00:00:00 UTC ignoring leap seconds). + def to_i + value + end + + # Formats this {Timestamp} according to the directives in the given format + # string. + # + # @param format [String] the format string. Please refer to `Time#strftime` + # for a list of supported format directives. + # @return [String] the formatted {Timestamp}. + # @raise [ArgumentError] if `format` is not specified. + def strftime(format) + raise ArgumentError, 'format must be specified' unless format + to_time.strftime(format) + end + + # @return [String] a `String` representation of this {Timestamp}. + def to_s + return value_and_sub_second_to_s unless @utc_offset + return "#{value_and_sub_second_to_s} UTC" if @utc + + sign = @utc_offset >= 0 ? '+' : '-' + min, sec = @utc_offset.abs.divmod(60) + hour, min = min.divmod(60) + + "#{value_and_sub_second_to_s(@utc_offset)} #{sign}#{'%02d' % hour}:#{'%02d' % min}#{sec > 0 ? ':%02d' % sec : nil}#{@utc_offset != 0 ? " (#{value_and_sub_second_to_s} UTC)" : nil}" + end + + # Compares this {Timestamp} with another. + # + # {Timestamp} instances without a defined UTC offset are not comparable with + # {Timestamp} instances that have a defined UTC offset. + # + # @param t [Timestamp] the {Timestamp} to compare this instance with. + # @return [Integer] -1, 0 or 1 depending if this instance is earlier, equal + # or later than `t` respectively. Returns `nil` when comparing a + # {Timestamp} that does not have a defined UTC offset with a {Timestamp} + # that does have a defined UTC offset. Returns `nil` if `t` is not a + # {Timestamp}. + def <=>(t) + return nil unless t.kind_of?(Timestamp) + return nil if utc_offset && !t.utc_offset + return nil if !utc_offset && t.utc_offset + + result = value <=> t.value + result = sub_second <=> t.sub_second if result == 0 + result + end + + alias eql? == + + # @return [Integer] a hash based on the value, sub-second and whether there + # is a defined UTC offset. + def hash + [@value, @sub_second, !!@utc_offset].hash + end + + # @return [String] the internal object state as a programmer-readable + # `String`. + def inspect + "#<#{self.class}: @value=#{@value}, @sub_second=#{@sub_second}, @utc_offset=#{@utc_offset.inspect}, @utc=#{@utc.inspect}>" + end + + protected + + # Creates a new instance of a `Time` or `Time`-like class matching the + # {value} and {sub_second} of this {Timestamp}, but not setting the offset. + # + # @param klass [Class] the class to instantiate. + # + # @private + def new_time(klass = Time) + klass.at(@value, @sub_second * 1_000_000) + end + + # Constructs a new instance of a `DateTime` or `DateTime`-like class with + # the same {value}, {sub_second} and {utc_offset} as this {Timestamp}. + # + # @param klass [Class] the class to instantiate. + # + # @private + def new_datetime(klass = DateTime) + datetime = klass.jd(JD_EPOCH + ((@value.to_r + @sub_second) / 86400)) + @utc_offset && @utc_offset != 0 ? datetime.new_offset(Rational(@utc_offset, 86400)) : datetime + end + + private + + # Converts the value and sub-seconds to a `String`, adding on the given + # offset. + # + # @param offset [Integer] the offset to add to the value. + # @return [String] the value and sub-seconds. + def value_and_sub_second_to_s(offset = 0) + "#{@value + offset}#{sub_second_to_s}" + end + + # Converts the {sub_second} value to a `String` suitable for appending to + # the `String` representation of a {Timestamp}. + # + # @return [String] a `String` representation of {sub_second}. + def sub_second_to_s + if @sub_second == 0 + '' + else + " #{@sub_second.numerator}/#{@sub_second.denominator}" + end + end + + # Initializes a new {Timestamp} without validating the parameters. This + # method is used internally within {Timestamp} to avoid the overhead of + # checking parameters. + # + # @param value [Integer] the number of seconds since 1970-01-01 00:00:00 UTC + # ignoring leap seconds. + # @param sub_second [Numeric] the fractional part of the second as either a + # `Rational` that is greater than or equal to 0 and less than 1, or the + # `Integer` 0. + # @param utc_offset [Object] either `nil` for a {Timestamp} without a + # specified offset, an offset from UTC specified as an `Integer` number of + # seconds or the `Symbol` `:utc`). + def initialize!(value, sub_second = 0, utc_offset = nil) + @value = value + + # Convert Rational(0,1) to 0. + @sub_second = sub_second == 0 ? 0 : sub_second + + if utc_offset + @utc = utc_offset == :utc + @utc_offset = @utc ? 0 : utc_offset + else + @utc = @utc_offset = nil + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timestamp_with_offset.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timestamp_with_offset.rb new file mode 100644 index 0000000000..5fd6212604 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timestamp_with_offset.rb @@ -0,0 +1,85 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + # A subclass of {Timestamp} used to represent local times. + # {TimestampWithOffset} holds a reference to the related {TimezoneOffset} and + # overrides various methods to return results appropriate for the + # {TimezoneOffset}. Certain operations will clear the associated + # {TimezoneOffset} (if the {TimezoneOffset} would not necessarily be valid for + # the result). Once the {TimezoneOffset} has been cleared, + # {TimestampWithOffset} behaves identically to {Timestamp}. + class TimestampWithOffset < Timestamp + include WithOffset + + # @return [TimezoneOffset] the {TimezoneOffset} associated with this + # instance. + attr_reader :timezone_offset + + # Creates a new {TimestampWithOffset} from a given {Timestamp} and + # {TimezoneOffset}. + # + # @param timestamp [Timestamp] a {Timestamp}. + # @param timezone_offset [TimezoneOffset] a {TimezoneOffset} valid at the + # time of `timestamp`. + # @return [TimestampWithOffset] a {TimestampWithOffset} that has the same + # {value value} and {sub_second sub_second} as the `timestamp` parameter, + # a {utc_offset utc_offset} equal to the + # {TimezoneOffset#observed_utc_offset observed_utc_offset} of the + # `timezone_offset` parameter and {timezone_offset timezone_offset} set to + # the `timezone_offset` parameter. + # @raise [ArgumentError] if `timestamp` or `timezone_offset` is `nil`. + def self.set_timezone_offset(timestamp, timezone_offset) + raise ArgumentError, 'timestamp must be specified' unless timestamp + raise ArgumentError, 'timezone_offset must be specified' unless timezone_offset + new!(timestamp.value, timestamp.sub_second, timezone_offset.observed_utc_offset).set_timezone_offset(timezone_offset) + end + + # Sets the associated {TimezoneOffset} of this {TimestampWithOffset}. + # + # @param timezone_offset [TimezoneOffset] a {TimezoneOffset} valid at the time + # and for the offset of this {TimestampWithOffset}. + # @return [TimestampWithOffset] `self`. + # @raise [ArgumentError] if `timezone_offset` is `nil`. + # @raise [ArgumentError] if {utc? self.utc?} is `true`. + # @raise [ArgumentError] if `timezone_offset.observed_utc_offset` does not equal + # `self.utc_offset`. + def set_timezone_offset(timezone_offset) + raise ArgumentError, 'timezone_offset must be specified' unless timezone_offset + raise ArgumentError, 'timezone_offset.observed_utc_offset does not match self.utc_offset' if utc? || utc_offset != timezone_offset.observed_utc_offset + @timezone_offset = timezone_offset + self + end + + # An overridden version of {Timestamp#to_time} that, if there is an + # associated {TimezoneOffset}, returns a {TimeWithOffset} with that offset. + # + # @return [Time] if there is an associated {TimezoneOffset}, a + # {TimeWithOffset} representation of this {TimestampWithOffset}, otherwise + # a `Time` representation. + def to_time + to = timezone_offset + if to + new_time(TimeWithOffset).set_timezone_offset(to) + else + super + end + end + + # An overridden version of {Timestamp#to_datetime}, if there is an + # associated {TimezoneOffset}, returns a {DateTimeWithOffset} with that + # offset. + # + # @return [DateTime] if there is an associated {TimezoneOffset}, a + # {DateTimeWithOffset} representation of this {TimestampWithOffset}, + # otherwise a `DateTime` representation. + def to_datetime + to = timezone_offset + if to + new_datetime(DateTimeWithOffset).set_timezone_offset(to) + else + super + end + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timezone.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timezone.rb new file mode 100644 index 0000000000..1fb5681307 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timezone.rb @@ -0,0 +1,1160 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +require 'set' + +module TZInfo + # {AmbiguousTime} is raised to indicate that a specified local time has more + # than one possible equivalent UTC time. Such ambiguities arise when the + # clocks are set back in a time zone, most commonly during the repeated hour + # when transitioning from daylight savings time to standard time. + # + # {AmbiguousTime} is raised by {Timezone#local_datetime}, + # {Timezone#local_time}, {Timezone#local_timestamp}, {Timezone#local_to_utc} + # and {Timezone#period_for_local} when using an ambiguous time and not + # specifying how to resolve the ambiguity. + class AmbiguousTime < StandardError + end + + # {PeriodNotFound} is raised to indicate that no {TimezonePeriod} matching a + # given time could be found. + class PeriodNotFound < StandardError + end + + # {InvalidTimezoneIdentifier} is raised by {Timezone.get} if the identifier + # given is not valid. + class InvalidTimezoneIdentifier < StandardError + end + + # {UnknownTimezone} is raised when calling methods on an instance of + # {Timezone} that was created directly. To obtain {Timezone} instances the + # {Timezone.get} method should be used instead. + class UnknownTimezone < StandardError + end + + # The {Timezone} class represents a time zone. It provides a factory method, + # {get}, to retrieve {Timezone} instances by their identifier. + # + # The {Timezone#to_local} method can be used to convert `Time` and `DateTime` + # instances to the local time for the zone. For example: + # + # tz = TZInfo::Timezone.get('America/New_York') + # local_time = tz.to_local(Time.utc(2005,8,29,15,35,0)) + # local_datetime = tz.to_local(DateTime.new(2005,8,29,15,35,0)) + # + # Local `Time` and `DateTime` instances returned by `Timezone` have the + # correct local offset. + # + # The {Timezone#local_to_utc} method can by used to convert local `Time` and + # `DateTime` instances to UTC. {Timezone#local_to_utc} ignores the UTC offset + # of the supplied value and treats if it is a local time for the zone. For + # example: + # + # tz = TZInfo::Timezone.get('America/New_York') + # utc_time = tz.local_to_utc(Time.new(2005,8,29,11,35,0)) + # utc_datetime = tz.local_to_utc(DateTime.new(2005,8,29,11,35,0)) + # + # Each time zone is treated as sequence of periods of time ({TimezonePeriod}) + # that observe the same offset ({TimezoneOffset}). Transitions + # ({TimezoneTransition}) denote the end of one period and the start of the + # next. The {Timezone} class has methods that allow the periods, offsets and + # transitions of a time zone to be interrogated. + # + # All methods that take `Time` objects as parameters can be used with + # arbitrary `Time`-like objects that respond to both `to_i` and `subsec` and + # optionally `utc_offset`. + # + # The {Timezone} class is thread-safe. It is safe to use class and instance + # methods of {Timezone} in concurrently executing threads. Instances of + # {Timezone} can be shared across thread boundaries. + # + # The IANA Time Zone Database maintainers recommend that time zone identifiers + # are not made visible to end-users (see [Names of + # timezones](https://data.iana.org/time-zones/theory.html#naming)). The + # {Country} class can be used to obtain lists of time zones by country, + # including user-friendly descriptions and approximate locations. + # + # @abstract The {get} method returns an instance of either {DataTimezone} or + # {LinkedTimezone}. The {get_proxy} method and other methods returning + # collections of time zones return instances of {TimezoneProxy}. + class Timezone + include Comparable + + # The default value of the dst parameter of the {local_datetime}, + # {local_time}, {local_timestamp}, {local_to_utc} and {period_for_local} + # methods. + # + # @!visibility private + @@default_dst = nil + + class << self + # Sets the default value of the optional `dst` parameter of the + # {local_datetime}, {local_time}, {local_timestamp}, {local_to_utc} and + # {period_for_local} methods. Can be set to `nil`, `true` or `false`. + # + # @param value [Boolean] `nil`, `true` or `false`. + def default_dst=(value) + @@default_dst = value.nil? ? nil : !!value + end + + # Returns the default value of the optional `dst` parameter of the + # {local_time}, {local_datetime} and {local_timestamp}, {local_to_utc} + # and {period_for_local} methods (`nil`, `true` or `false`). + # + # {default_dst} defaults to `nil` unless changed with {default_dst=}. + # + # @return [Boolean] the default value of the optional `dst` parameter of + # the {local_time}, {local_datetime} and {local_timestamp}, + # {local_to_utc} and {period_for_local} methods (`nil`, `true` or + # `false`). + def default_dst + @@default_dst + end + + # Returns a time zone by its IANA Time Zone Database identifier (e.g. + # `"Europe/London"` or `"America/Chicago"`). Call {all_identifiers} for a + # list of all the valid identifiers. + # + # The {get} method will return a subclass of {Timezone}, either a + # {DataTimezone} (for a time zone defined by rules that set out when + # transitions occur) or a {LinkedTimezone} (for a time zone that is just a + # link to or alias for a another time zone). + # + # @param identifier [String] an IANA Time Zone Database time zone + # identifier. + # @return [Timezone] the {Timezone} with the given `identifier`. + # @raise [InvalidTimezoneIdentifier] if the `identifier` is not valid. + def get(identifier) + data_source.get_timezone_info(identifier).create_timezone + end + + # Returns a proxy for the time zone with the given identifier. This allows + # loading of the time zone data to be deferred until it is first needed. + # + # The identifier will not be validated. If an invalid identifier is + # specified, no exception will be raised until the proxy is used. + # + # @param identifier [String] an IANA Time Zone Database time zone + # identifier. + # @return [TimezoneProxy] a proxy for the time zone with the given + # `identifier`. + def get_proxy(identifier) + TimezoneProxy.new(identifier) + end + + # Returns an `Array` of all the available time zones. + # + # {TimezoneProxy} instances are returned to avoid the overhead of loading + # time zone data until it is first needed. + # + # @return [Array] all available time zones. + def all + get_proxies(all_identifiers) + end + + # @return [Array] an `Array` containing the identifiers of all the + # available time zones. + def all_identifiers + data_source.timezone_identifiers + end + + # Returns an `Array` of all the available time zones that are + # defined by offsets and transitions. + # + # {TimezoneProxy} instances are returned to avoid the overhead of loading + # time zone data until it is first needed. + # + # @return [Array] an `Array` of all the available time zones + # that are defined by offsets and transitions. + def all_data_zones + get_proxies(all_data_zone_identifiers) + end + + # @return [Array] an `Array` of the identifiers of all available + # time zones that are defined by offsets and transitions. + def all_data_zone_identifiers + data_source.data_timezone_identifiers + end + + # Returns an `Array` of all the available time zones that are + # defined as links to / aliases for other time zones. + # + # {TimezoneProxy} instances are returned to avoid the overhead of loading + # time zone data until it is first needed. + # + # @return [Array] an `Array` of all the available time zones + # that are defined as links to / aliases for other time zones. + def all_linked_zones + get_proxies(all_linked_zone_identifiers) + end + + # @return [Array] an `Array` of the identifiers of all available + # time zones that are defined as links to / aliases for other time zones. + def all_linked_zone_identifiers + data_source.linked_timezone_identifiers + end + + # Returns an `Array` of all the time zones that are observed by at least + # one {Country}. This is not the complete set of time zones as some are + # not country specific (e.g. `'Etc/GMT'`). + # + # {TimezoneProxy} instances are returned to avoid the overhead of loading + # time zone data until it is first needed. + # + # @return [Array] an `Array` of all the time zones that are + # observed by at least one {Country}. + def all_country_zones + Country.all.map(&:zones).flatten.uniq + end + + # Returns an `Array` of the identifiers of all the time zones that are + # observed by at least one {Country}. This is not the complete set of time + # zone identifiers as some are not country specific (e.g. `'Etc/GMT'`). + # + # {TimezoneProxy} instances are returned to avoid the overhead of loading + # time zone data until it is first needed. + # + # @return [Array] an `Array` of the identifiers of all the time + # zones that are observed by at least one {Country}. + def all_country_zone_identifiers + Country.all.map(&:zone_identifiers).flatten.uniq + end + + private + + # @param [Enumerable] identifiers an `Enumerable` of time zone + # identifiers. + # @return [Array] an `Array` of {TimezoneProxy} + # instances corresponding to the given identifiers. + def get_proxies(identifiers) + identifiers.collect {|identifier| get_proxy(identifier)} + end + + # @return [DataSource] the current DataSource. + def data_source + DataSource.get + end + end + + # @return [String] the identifier of the time zone, for example, + # `"Europe/Paris"`. + def identifier + raise_unknown_timezone + end + + # @return [String] the identifier of the time zone, for example, + # `"Europe/Paris"`. + def name + # Don't use alias, as identifier gets overridden. + identifier + end + + # @return [String] {identifier}, modified to make it more readable. + def to_s + friendly_identifier + end + + # @return [String] the internal object state as a programmer-readable + # `String`. + def inspect + "#<#{self.class}: #{identifier}>" + end + + # Returns {identifier}, modified to make it more readable. Set + # `skip_first_part` to omit the first part of the identifier (typically a + # region name) where there is more than one part. + # + # For example: + # + # TZInfo::Timezone.get('Europe/Paris').friendly_identifier(false) #=> "Europe - Paris" + # TZInfo::Timezone.get('Europe/Paris').friendly_identifier(true) #=> "Paris" + # TZInfo::Timezone.get('America/Indiana/Knox').friendly_identifier(false) #=> "America - Knox, Indiana" + # TZInfo::Timezone.get('America/Indiana/Knox').friendly_identifier(true) #=> "Knox, Indiana" + # + # @param skip_first_part [Boolean] whether the first part of the identifier + # (typically a region name) should be omitted. + # @return [String] the modified identifier. + def friendly_identifier(skip_first_part = false) + id = identifier + id = id.encode(Encoding::UTF_8) unless id.encoding.ascii_compatible? + parts = id.split('/') + if parts.empty? + # shouldn't happen + identifier + elsif parts.length == 1 + parts[0] + else + prefix = skip_first_part ? nil : "#{parts[0]} - " + + parts = parts.drop(1).map do |part| + part.gsub!(/_/, ' ') + + if part.index(/[a-z]/) + # Missing a space if a lower case followed by an upper case and the + # name isn't McXxxx. + part.gsub!(/([^M][a-z])([A-Z])/, '\1 \2') + part.gsub!(/([M][a-bd-z])([A-Z])/, '\1 \2') + + # Missing an apostrophe if two consecutive upper case characters. + part.gsub!(/([A-Z])([A-Z])/, '\1\'\2') + end + + part + end + + "#{prefix}#{parts.reverse.join(', ')}" + end + end + + # Returns the {TimezonePeriod} that is valid at a given time. + # + # Unlike {period_for_local} and {period_for_utc}, the UTC offset of the + # `time` parameter is taken into consideration. + # + # @param time [Object] a `Time`, `DateTime` or {Timestamp}. + # @return [TimezonePeriod] the {TimezonePeriod} that is valid at `time`. + # @raise [ArgumentError] if `time` is `nil`. + # @raise [ArgumentError] if `time` is a {Timestamp} with an unspecified + # offset. + def period_for(time) + raise_unknown_timezone + end + + # Returns the set of {TimezonePeriod}s that are valid for the given + # local time as an `Array`. + # + # The UTC offset of the `local_time` parameter is ignored (it is treated as + # a time in the time zone represented by `self`). + # + # This will typically return an `Array` containing a single + # {TimezonePeriod}. More than one {TimezonePeriod} will be returned when the + # local time is ambiguous (for example, when daylight savings time ends). An + # empty `Array` will be returned when the local time is not valid (for + # example, when daylight savings time begins). + # + # To obtain just a single {TimezonePeriod} in all cases, use + # {period_for_local} instead and specify how ambiguities should be resolved. + # + # @param local_time [Object] a `Time`, `DateTime` or {Timestamp}. + # @return [Array] the set of {TimezonePeriod}s that are + # valid at `local_time`. + # @raise [ArgumentError] if `local_time` is `nil`. + def periods_for_local(local_time) + raise_unknown_timezone + end + + # Returns an `Array` of {TimezoneTransition} instances representing the + # times where the UTC offset of the timezone changes. + # + # Transitions are returned up to a given time (`to`). + # + # A from time may also be supplied using the `from` parameter. If from is + # not `nil`, only transitions from that time onwards will be returned. + # + # Comparisons with `to` are exclusive. Comparisons with `from` are + # inclusive. If a transition falls precisely on `to`, it will be excluded. + # If a transition falls on `from`, it will be included. + # + # @param to [Object] a `Time`, `DateTime` or {Timestamp} specifying the + # latest (exclusive) transition to return. + # @param from [Object] an optional `Time`, `DateTime` or {Timestamp} + # specifying the earliest (inclusive) transition to return. + # @return [Array] the transitions that are earlier than + # `to` and, if specified, at or later than `from`. Transitions are ordered + # by when they occur, from earliest to latest. + # @raise [ArgumentError] if `from` is specified and `to` is not greater than + # `from`. + # @raise [ArgumentError] is raised if `to` is `nil`. + # @raise [ArgumentError] if either `to` or `from` is a {Timestamp} with an + # unspecified offset. + def transitions_up_to(to, from = nil) + raise_unknown_timezone + end + + # Returns the canonical {Timezone} instance for this {Timezone}. + # + # The IANA Time Zone database contains two types of definition: Zones and + # Links. Zones are defined by rules that set out when transitions occur. + # Links are just references to fully defined Zone, creating an alias for + # that Zone. + # + # Links are commonly used where a time zone has been renamed in a release of + # the Time Zone database. For example, the US/Eastern Zone was renamed as + # America/New_York. A US/Eastern Link was added in its place, linking to + # (and creating an alias for) America/New_York. + # + # Links are also used for time zones that are currently identical to a full + # Zone, but that are administered separately. For example, Europe/Vatican is + # a Link to (and alias for) Europe/Rome. + # + # For a full Zone (implemented by {DataTimezone}), {canonical_zone} returns + # self. + # + # For a Link (implemented by {LinkedTimezone}), {canonical_zone} returns a + # {Timezone} instance representing the full Zone that the link targets. + # + # TZInfo can be used with different data sources (see the documentation for + # {TZInfo::DataSource}). Some DataSource implementations may not support + # distinguishing between full Zones and Links and will treat all time zones + # as full Zones. In this case, {canonical_zone} will always return `self`. + # + # There are two built-in DataSource implementations. + # {DataSources::RubyDataSource} (which will be used if the tzinfo-data gem + # is available) supports Link zones. {DataSources::ZoneinfoDataSource} + # returns Link zones as if they were full Zones. If the {canonical_zone} or + # {canonical_identifier} methods are needed, the tzinfo-data gem should be + # installed. + # + # The {TZInfo::DataSource.get} method can be used to check which DataSource + # implementation is being used. + # + # @return [Timezone] the canonical {Timezone} instance for this {Timezone}. + def canonical_zone + raise_unknown_timezone + end + + # Returns the {TimezonePeriod} that is valid at a given time. + # + # The UTC offset of the `utc_time` parameter is ignored (it is treated as a + # UTC time). Use the {period_for} method instead if the UTC offset of the + # time needs to be taken into consideration. + # + # @param utc_time [Object] a `Time`, `DateTime` or {Timestamp}. + # @return [TimezonePeriod] the {TimezonePeriod} that is valid at `utc_time`. + # @raise [ArgumentError] if `utc_time` is `nil`. + def period_for_utc(utc_time) + raise ArgumentError, 'utc_time must be specified' unless utc_time + period_for(Timestamp.for(utc_time, :treat_as_utc)) + end + + # Returns the {TimezonePeriod} that is valid at the given local time. + # + # The UTC offset of the `local_time` parameter is ignored (it is treated as + # a time in the time zone represented by `self`). Use the {period_for} + # method instead if the the UTC offset of the time needs to be taken into + # consideration. + # + # _Warning:_ There are local times that have no equivalent UTC times (for + # example, during the transition from standard time to daylight savings + # time). There are also local times that have more than one UTC equivalent + # (for example, during the transition from daylight savings time to standard + # time). + # + # In the first case (no equivalent UTC time), a {PeriodNotFound} exception + # will be raised. + # + # In the second case (more than one equivalent UTC time), an {AmbiguousTime} + # exception will be raised unless the optional `dst` parameter or block + # handles the ambiguity. + # + # If the ambiguity is due to a transition from daylight savings time to + # standard time, the `dst` parameter can be used to select whether the + # daylight savings time or local time is used. For example, the following + # code would raise an {AmbiguousTime} exception: + # + # tz = TZInfo::Timezone.get('America/New_York') + # tz.period_for_local(Time.new(2004,10,31,1,30,0)) + # + # Specifying `dst = true` would select the daylight savings period from + # April to October 2004. Specifying `dst = false` would return the + # standard time period from October 2004 to April 2005. + # + # The `dst` parameter will not be able to resolve an ambiguity resulting + # from the clocks being set back without changing from daylight savings time + # to standard time. In this case, if a block is specified, it will be called + # to resolve the ambiguity. The block must take a single parameter - an + # `Array` of {TimezonePeriod}s that need to be resolved. The block can + # select and return a single {TimezonePeriod} or return `nil` or an empty + # `Array` to cause an {AmbiguousTime} exception to be raised. + # + # The default value of the `dst` parameter can be specified using + # {Timezone.default_dst=}. + # + # @param local_time [Object] a `Time`, `DateTime` or {Timestamp}. + # @param dst [Boolean] whether to resolve ambiguous local times by always + # selecting the period observing daylight savings time (`true`), always + # selecting the period observing standard time (`false`), or leaving the + # ambiguity unresolved (`nil`). + # @yield [periods] if the `dst` parameter did not resolve an ambiguity, an + # optional block is yielded to. + # @yieldparam periods [Array] an `Array` containing all + # the {TimezonePeriod}s that still match `local_time` after applying the + # `dst` parameter. + # @yieldreturn [Object] to resolve the ambiguity: a chosen {TimezonePeriod} + # or an `Array` containing a chosen {TimezonePeriod}; to leave the + # ambiguity unresolved: an empty `Array`, an `Array` containing more than + # one {TimezonePeriod}, or `nil`. + # @return [TimezonePeriod] the {TimezonePeriod} that is valid at + # `local_time`. + # @raise [ArgumentError] if `local_time` is `nil`. + # @raise [PeriodNotFound] if `local_time` is not valid for the time zone + # (there is no equivalent UTC time). + # @raise [AmbiguousTime] if `local_time` was ambiguous for the time zone and + # the `dst` parameter or block did not resolve the ambiguity. + def period_for_local(local_time, dst = Timezone.default_dst) + raise ArgumentError, 'local_time must be specified' unless local_time + local_time = Timestamp.for(local_time, :ignore) + results = periods_for_local(local_time) + + if results.empty? + raise PeriodNotFound, "#{local_time.strftime('%Y-%m-%d %H:%M:%S')} is an invalid local time." + elsif results.size < 2 + results.first + else + # ambiguous result try to resolve + + if !dst.nil? + matches = results.find_all {|period| period.dst? == dst} + results = matches if !matches.empty? + end + + if results.size < 2 + results.first + else + # still ambiguous, try the block + + if block_given? + results = yield results + end + + if results.is_a?(TimezonePeriod) + results + elsif results && results.size == 1 + results.first + else + raise AmbiguousTime, "#{local_time.strftime('%Y-%m-%d %H:%M:%S')} is an ambiguous local time." + end + end + end + end + + # Converts a time to the local time for the time zone. + # + # The result will be of type {TimeWithOffset} (if passed a `Time`), + # {DateTimeWithOffset} (if passed a `DateTime`) or {TimestampWithOffset} (if + # passed a {Timestamp}). {TimeWithOffset}, {DateTimeWithOffset} and + # {TimestampWithOffset} are subclasses of `Time`, `DateTime` and {Timestamp} + # that provide additional information about the local result. + # + # Unlike {utc_to_local}, {to_local} takes the UTC offset of the given time + # into consideration. + # + # @param time [Object] a `Time`, `DateTime` or {Timestamp}. + # @return [Object] the local equivalent of `time` as a {TimeWithOffset}, + # {DateTimeWithOffset} or {TimestampWithOffset}. + # @raise [ArgumentError] if `time` is `nil`. + # @raise [ArgumentError] if `time` is a {Timestamp} that does not have a + # specified UTC offset. + def to_local(time) + raise ArgumentError, 'time must be specified' unless time + + Timestamp.for(time) do |ts| + TimestampWithOffset.set_timezone_offset(ts, period_for(ts).offset) + end + end + + # Converts a time in UTC to the local time for the time zone. + # + # The result will be of type {TimeWithOffset} (if passed a `Time`), + # {DateTimeWithOffset} (if passed a `DateTime`) or {TimestampWithOffset} (if + # passed a {Timestamp}). {TimeWithOffset}, {DateTimeWithOffset} and + # {TimestampWithOffset} are subclasses of `Time`, `DateTime` and {Timestamp} + # that provide additional information about the local result. + # + # The UTC offset of the `utc_time` parameter is ignored (it is treated as a + # UTC time). Use the {to_local} method instead if the the UTC offset of the + # time needs to be taken into consideration. + # + # @param utc_time [Object] a `Time`, `DateTime` or {Timestamp}. + # @return [Object] the local equivalent of `utc_time` as a {TimeWithOffset}, + # {DateTimeWithOffset} or {TimestampWithOffset}. + # @raise [ArgumentError] if `utc_time` is `nil`. + def utc_to_local(utc_time) + raise ArgumentError, 'utc_time must be specified' unless utc_time + + Timestamp.for(utc_time, :treat_as_utc) do |ts| + to_local(ts) + end + end + + # Converts a local time for the time zone to UTC. + # + # The result will either be a `Time`, `DateTime` or {Timestamp} according to + # the type of the `local_time` parameter. + # + # The UTC offset of the `local_time` parameter is ignored (it is treated as + # a time in the time zone represented by `self`). + # + # _Warning:_ There are local times that have no equivalent UTC times (for + # example, during the transition from standard time to daylight savings + # time). There are also local times that have more than one UTC equivalent + # (for example, during the transition from daylight savings time to standard + # time). + # + # In the first case (no equivalent UTC time), a {PeriodNotFound} exception + # will be raised. + # + # In the second case (more than one equivalent UTC time), an {AmbiguousTime} + # exception will be raised unless the optional `dst` parameter or block + # handles the ambiguity. + # + # If the ambiguity is due to a transition from daylight savings time to + # standard time, the `dst` parameter can be used to select whether the + # daylight savings time or local time is used. For example, the following + # code would raise an {AmbiguousTime} exception: + # + # tz = TZInfo::Timezone.get('America/New_York') + # tz.period_for_local(Time.new(2004,10,31,1,30,0)) + # + # Specifying `dst = true` would select the daylight savings period from + # April to October 2004. Specifying `dst = false` would return the + # standard time period from October 2004 to April 2005. + # + # The `dst` parameter will not be able to resolve an ambiguity resulting + # from the clocks being set back without changing from daylight savings time + # to standard time. In this case, if a block is specified, it will be called + # to resolve the ambiguity. The block must take a single parameter - an + # `Array` of {TimezonePeriod}s that need to be resolved. The block can + # select and return a single {TimezonePeriod} or return `nil` or an empty + # `Array` to cause an {AmbiguousTime} exception to be raised. + # + # The default value of the `dst` parameter can be specified using + # {Timezone.default_dst=}. + # + # @param local_time [Object] a `Time`, `DateTime` or {Timestamp}. + # @param dst [Boolean] whether to resolve ambiguous local times by always + # selecting the period observing daylight savings time (`true`), always + # selecting the period observing standard time (`false`), or leaving the + # ambiguity unresolved (`nil`). + # @yield [periods] if the `dst` parameter did not resolve an ambiguity, an + # optional block is yielded to. + # @yieldparam periods [Array] an `Array` containing all + # the {TimezonePeriod}s that still match `local_time` after applying the + # `dst` parameter. + # @yieldreturn [Object] to resolve the ambiguity: a chosen {TimezonePeriod} + # or an `Array` containing a chosen {TimezonePeriod}; to leave the + # ambiguity unresolved: an empty `Array`, an `Array` containing more than + # one {TimezonePeriod}, or `nil`. + # @return [Object] the UTC equivalent of `local_time` as a `Time`, + # `DateTime` or {Timestamp}. + # @raise [ArgumentError] if `local_time` is `nil`. + # @raise [PeriodNotFound] if `local_time` is not valid for the time zone + # (there is no equivalent UTC time). + # @raise [AmbiguousTime] if `local_time` was ambiguous for the time zone and + # the `dst` parameter or block did not resolve the ambiguity. + def local_to_utc(local_time, dst = Timezone.default_dst) + raise ArgumentError, 'local_time must be specified' unless local_time + + Timestamp.for(local_time, :ignore) do |ts| + period = if block_given? + period_for_local(ts, dst) {|periods| yield periods } + else + period_for_local(ts, dst) + end + + ts.add_and_set_utc_offset(-period.observed_utc_offset, :utc) + end + end + + # Creates a `Time` object based on the given (Gregorian calendar) date and + # time parameters. The parameters are interpreted as a local time in the + # time zone. The result has the appropriate `utc_offset`, `zone` and + # {TimeWithOffset#timezone_offset timezone_offset}. + # + # _Warning:_ There are time values that are not valid as local times in a + # time zone (for example, during the transition from standard time to + # daylight savings time). There are also time values that are ambiguous, + # occurring more than once with different offsets to UTC (for example, + # during the transition from daylight savings time to standard time). + # + # In the first case (an invalid local time), a {PeriodNotFound} exception + # will be raised. + # + # In the second case (more than one occurrence), an {AmbiguousTime} + # exception will be raised unless the optional `dst` parameter or block + # handles the ambiguity. + # + # If the ambiguity is due to a transition from daylight savings time to + # standard time, the `dst` parameter can be used to select whether the + # daylight savings time or local time is used. For example, the following + # code would raise an {AmbiguousTime} exception: + # + # tz = TZInfo::Timezone.get('America/New_York') + # tz.local_time(2004,10,31,1,30,0,0) + # + # Specifying `dst = true` would return a `Time` with a UTC offset of -4 + # hours and abbreviation EDT (Eastern Daylight Time). Specifying `dst = + # false` would return a `Time` with a UTC offset of -5 hours and + # abbreviation EST (Eastern Standard Time). + # + # The `dst` parameter will not be able to resolve an ambiguity resulting + # from the clocks being set back without changing from daylight savings time + # to standard time. In this case, if a block is specified, it will be called + # to resolve the ambiguity. The block must take a single parameter - an + # `Array` of {TimezonePeriod}s that need to be resolved. The block can + # select and return a single {TimezonePeriod} or return `nil` or an empty + # `Array` to cause an {AmbiguousTime} exception to be raised. + # + # The default value of the `dst` parameter can be specified using + # {Timezone.default_dst=}. + # + # @param year [Integer] the year. + # @param month [Integer] the month (1-12). + # @param day [Integer] the day of the month (1-31). + # @param hour [Integer] the hour (0-23). + # @param minute [Integer] the minute (0-59). + # @param second [Integer] the second (0-59). + # @param sub_second [Numeric] the fractional part of the second as either + # a `Rational` that is greater than or equal to 0 and less than 1, or + # the `Integer` 0. + # @param dst [Boolean] whether to resolve ambiguous local times by always + # selecting the period observing daylight savings time (`true`), always + # selecting the period observing standard time (`false`), or leaving the + # ambiguity unresolved (`nil`). + # @yield [periods] if the `dst` parameter did not resolve an ambiguity, an + # optional block is yielded to. + # @yieldparam periods [Array] an `Array` containing all + # the {TimezonePeriod}s that still match `local_time` after applying the + # `dst` parameter. + # @yieldreturn [Object] to resolve the ambiguity: a chosen {TimezonePeriod} + # or an `Array` containing a chosen {TimezonePeriod}; to leave the + # ambiguity unresolved: an empty `Array`, an `Array` containing more than + # one {TimezonePeriod}, or `nil`. + # @return [TimeWithOffset] a new `Time` object based on the given values, + # interpreted as a local time in the time zone. + # @raise [ArgumentError] if either of `year`, `month`, `day`, `hour`, + # `minute`, or `second` is not an `Integer`. + # @raise [ArgumentError] if `sub_second` is not a `Rational`, or the + # `Integer` 0. + # @raise [ArgumentError] if `utc_offset` is not `nil`, not an `Integer` + # and not the `Symbol` `:utc`. + # @raise [RangeError] if `month` is not between 1 and 12. + # @raise [RangeError] if `day` is not between 1 and 31. + # @raise [RangeError] if `hour` is not between 0 and 23. + # @raise [RangeError] if `minute` is not between 0 and 59. + # @raise [RangeError] if `second` is not between 0 and 59. + # @raise [RangeError] if `sub_second` is a `Rational` but that is less + # than 0 or greater than or equal to 1. + # @raise [PeriodNotFound] if the date and time parameters do not specify a + # valid local time in the time zone. + # @raise [AmbiguousTime] if the date and time parameters are ambiguous for + # the time zone and the `dst` parameter or block did not resolve the + # ambiguity. + def local_time(year, month = 1, day = 1, hour = 0, minute = 0, second = 0, sub_second = 0, dst = Timezone.default_dst, &block) + local_timestamp(year, month, day, hour, minute, second, sub_second, dst, &block).to_time + end + + # Creates a `DateTime` object based on the given (Gregorian calendar) date + # and time parameters. The parameters are interpreted as a local time in the + # time zone. The result has the appropriate `offset` and + # {DateTimeWithOffset#timezone_offset timezone_offset}. + # + # _Warning:_ There are time values that are not valid as local times in a + # time zone (for example, during the transition from standard time to + # daylight savings time). There are also time values that are ambiguous, + # occurring more than once with different offsets to UTC (for example, + # during the transition from daylight savings time to standard time). + # + # In the first case (an invalid local time), a {PeriodNotFound} exception + # will be raised. + # + # In the second case (more than one occurrence), an {AmbiguousTime} + # exception will be raised unless the optional `dst` parameter or block + # handles the ambiguity. + # + # If the ambiguity is due to a transition from daylight savings time to + # standard time, the `dst` parameter can be used to select whether the + # daylight savings time or local time is used. For example, the following + # code would raise an {AmbiguousTime} exception: + # + # tz = TZInfo::Timezone.get('America/New_York') + # tz.local_datetime(2004,10,31,1,30,0,0) + # + # Specifying `dst = true` would return a `Time` with a UTC offset of -4 + # hours and abbreviation EDT (Eastern Daylight Time). Specifying `dst = + # false` would return a `Time` with a UTC offset of -5 hours and + # abbreviation EST (Eastern Standard Time). + # + # The `dst` parameter will not be able to resolve an ambiguity resulting + # from the clocks being set back without changing from daylight savings time + # to standard time. In this case, if a block is specified, it will be called + # to resolve the ambiguity. The block must take a single parameter - an + # `Array` of {TimezonePeriod}s that need to be resolved. The block can + # select and return a single {TimezonePeriod} or return `nil` or an empty + # `Array` to cause an {AmbiguousTime} exception to be raised. + # + # The default value of the `dst` parameter can be specified using + # {Timezone.default_dst=}. + # + # @param year [Integer] the year. + # @param month [Integer] the month (1-12). + # @param day [Integer] the day of the month (1-31). + # @param hour [Integer] the hour (0-23). + # @param minute [Integer] the minute (0-59). + # @param second [Integer] the second (0-59). + # @param sub_second [Numeric] the fractional part of the second as either + # a `Rational` that is greater than or equal to 0 and less than 1, or + # the `Integer` 0. + # @param dst [Boolean] whether to resolve ambiguous local times by always + # selecting the period observing daylight savings time (`true`), always + # selecting the period observing standard time (`false`), or leaving the + # ambiguity unresolved (`nil`). + # @yield [periods] if the `dst` parameter did not resolve an ambiguity, an + # optional block is yielded to. + # @yieldparam periods [Array] an `Array` containing all + # the {TimezonePeriod}s that still match `local_time` after applying the + # `dst` parameter. + # @yieldreturn [Object] to resolve the ambiguity: a chosen {TimezonePeriod} + # or an `Array` containing a chosen {TimezonePeriod}; to leave the + # ambiguity unresolved: an empty `Array`, an `Array` containing more than + # one {TimezonePeriod}, or `nil`. + # @return [DateTimeWithOffset] a new `DateTime` object based on the given + # values, interpreted as a local time in the time zone. + # @raise [ArgumentError] if either of `year`, `month`, `day`, `hour`, + # `minute`, or `second` is not an `Integer`. + # @raise [ArgumentError] if `sub_second` is not a `Rational`, or the + # `Integer` 0. + # @raise [ArgumentError] if `utc_offset` is not `nil`, not an `Integer` + # and not the `Symbol` `:utc`. + # @raise [RangeError] if `month` is not between 1 and 12. + # @raise [RangeError] if `day` is not between 1 and 31. + # @raise [RangeError] if `hour` is not between 0 and 23. + # @raise [RangeError] if `minute` is not between 0 and 59. + # @raise [RangeError] if `second` is not between 0 and 59. + # @raise [RangeError] if `sub_second` is a `Rational` but that is less + # than 0 or greater than or equal to 1. + # @raise [PeriodNotFound] if the date and time parameters do not specify a + # valid local time in the time zone. + # @raise [AmbiguousTime] if the date and time parameters are ambiguous for + # the time zone and the `dst` parameter or block did not resolve the + # ambiguity. + def local_datetime(year, month = 1, day = 1, hour = 0, minute = 0, second = 0, sub_second = 0, dst = Timezone.default_dst, &block) + local_timestamp(year, month, day, hour, minute, second, sub_second, dst, &block).to_datetime + end + + # Creates a {Timestamp} object based on the given (Gregorian calendar) date + # and time parameters. The parameters are interpreted as a local time in the + # time zone. The result has the appropriate {Timestamp#utc_offset + # utc_offset} and {TimestampWithOffset#timezone_offset timezone_offset}. + # + # _Warning:_ There are time values that are not valid as local times in a + # time zone (for example, during the transition from standard time to + # daylight savings time). There are also time values that are ambiguous, + # occurring more than once with different offsets to UTC (for example, + # during the transition from daylight savings time to standard time). + # + # In the first case (an invalid local time), a {PeriodNotFound} exception + # will be raised. + # + # In the second case (more than one occurrence), an {AmbiguousTime} + # exception will be raised unless the optional `dst` parameter or block + # handles the ambiguity. + # + # If the ambiguity is due to a transition from daylight savings time to + # standard time, the `dst` parameter can be used to select whether the + # daylight savings time or local time is used. For example, the following + # code would raise an {AmbiguousTime} exception: + # + # tz = TZInfo::Timezone.get('America/New_York') + # tz.local_timestamp(2004,10,31,1,30,0,0) + # + # Specifying `dst = true` would return a `Time` with a UTC offset of -4 + # hours and abbreviation EDT (Eastern Daylight Time). Specifying `dst = + # false` would return a `Time` with a UTC offset of -5 hours and + # abbreviation EST (Eastern Standard Time). + # + # The `dst` parameter will not be able to resolve an ambiguity resulting + # from the clocks being set back without changing from daylight savings time + # to standard time. In this case, if a block is specified, it will be called + # to resolve the ambiguity. The block must take a single parameter - an + # `Array` of {TimezonePeriod}s that need to be resolved. The block can + # select and return a single {TimezonePeriod} or return `nil` or an empty + # `Array` to cause an {AmbiguousTime} exception to be raised. + # + # The default value of the `dst` parameter can be specified using + # {Timezone.default_dst=}. + # + # @param year [Integer] the year. + # @param month [Integer] the month (1-12). + # @param day [Integer] the day of the month (1-31). + # @param hour [Integer] the hour (0-23). + # @param minute [Integer] the minute (0-59). + # @param second [Integer] the second (0-59). + # @param sub_second [Numeric] the fractional part of the second as either + # a `Rational` that is greater than or equal to 0 and less than 1, or + # the `Integer` 0. + # @param dst [Boolean] whether to resolve ambiguous local times by always + # selecting the period observing daylight savings time (`true`), always + # selecting the period observing standard time (`false`), or leaving the + # ambiguity unresolved (`nil`). + # @yield [periods] if the `dst` parameter did not resolve an ambiguity, an + # optional block is yielded to. + # @yieldparam periods [Array] an `Array` containing all + # the {TimezonePeriod}s that still match `local_time` after applying the + # `dst` parameter. + # @yieldreturn [Object] to resolve the ambiguity: a chosen {TimezonePeriod} + # or an `Array` containing a chosen {TimezonePeriod}; to leave the + # ambiguity unresolved: an empty `Array`, an `Array` containing more than + # one {TimezonePeriod}, or `nil`. + # @return [TimestampWithOffset] a new {Timestamp} object based on the given + # values, interpreted as a local time in the time zone. + # @raise [ArgumentError] if either of `year`, `month`, `day`, `hour`, + # `minute`, or `second` is not an `Integer`. + # @raise [ArgumentError] if `sub_second` is not a `Rational`, or the + # `Integer` 0. + # @raise [ArgumentError] if `utc_offset` is not `nil`, not an `Integer` + # and not the `Symbol` `:utc`. + # @raise [RangeError] if `month` is not between 1 and 12. + # @raise [RangeError] if `day` is not between 1 and 31. + # @raise [RangeError] if `hour` is not between 0 and 23. + # @raise [RangeError] if `minute` is not between 0 and 59. + # @raise [RangeError] if `second` is not between 0 and 59. + # @raise [RangeError] if `sub_second` is a `Rational` but that is less + # than 0 or greater than or equal to 1. + # @raise [PeriodNotFound] if the date and time parameters do not specify a + # valid local time in the time zone. + # @raise [AmbiguousTime] if the date and time parameters are ambiguous for + # the time zone and the `dst` parameter or block did not resolve the + # ambiguity. + def local_timestamp(year, month = 1, day = 1, hour = 0, minute = 0, second = 0, sub_second = 0, dst = Timezone.default_dst, &block) + ts = Timestamp.create(year, month, day, hour, minute, second, sub_second) + timezone_offset = period_for_local(ts, dst, &block).offset + utc_offset = timezone_offset.observed_utc_offset + TimestampWithOffset.new(ts.value - utc_offset, sub_second, utc_offset).set_timezone_offset(timezone_offset) + end + + # Returns the unique offsets used by the time zone up to a given time (`to`) + # as an `Array` of {TimezoneOffset} instances. + # + # A from time may also be supplied using the `from` parameter. If from is + # not `nil`, only offsets used from that time onwards will be returned. + # + # Comparisons with `to` are exclusive. Comparisons with `from` are + # inclusive. + # + # @param to [Object] a `Time`, `DateTime` or {Timestamp} specifying the + # latest (exclusive) offset to return. + # @param from [Object] an optional `Time`, `DateTime` or {Timestamp} + # specifying the earliest (inclusive) offset to return. + # @return [Array] the offsets that are used earlier than + # `to` and, if specified, at or later than `from`. Offsets may be returned + # in any order. + # @raise [ArgumentError] if `from` is specified and `to` is not greater than + # `from`. + # @raise [ArgumentError] is raised if `to` is `nil`. + # @raise [ArgumentError] if either `to` or `from` is a {Timestamp} with an + # unspecified offset. + def offsets_up_to(to, from = nil) + raise ArgumentError, 'to must be specified' unless to + + to_timestamp = Timestamp.for(to) + from_timestamp = from && Timestamp.for(from) + transitions = transitions_up_to(to_timestamp, from_timestamp) + + if transitions.empty? + # No transitions in the range, find the period that covers it. + + if from_timestamp + # Use the from date as it is inclusive. + period = period_for(from_timestamp) + else + # to is exclusive, so this can't be used with period_for. However, any + # time earlier than to can be used. Subtract 1 hour. + period = period_for(to_timestamp.add_and_set_utc_offset(-3600, :utc)) + end + + [period.offset] + else + result = Set.new + + first = transitions.first + result << first.previous_offset unless from_timestamp && first.at == from_timestamp + + transitions.each do |t| + result << t.offset + end + + result.to_a + end + end + + # Returns the canonical identifier of this time zone. + # + # This is a shortcut for calling `canonical_zone.identifier`. Please refer + # to the {canonical_zone} documentation for further information. + # + # @return [String] the canonical identifier of this time zone. + def canonical_identifier + canonical_zone.identifier + end + + # @return [TimeWithOffset] the current local time in the time zone. + def now + to_local(Time.now) + end + + # @return [TimezonePeriod] the current {TimezonePeriod} for the time zone. + def current_period + period_for(Time.now) + end + + # Returns the current local time and {TimezonePeriod} for the time zone as + # an `Array`. The first element is the time as a {TimeWithOffset}. The + # second element is the period. + # + # @return [Array] an `Array` containing the current {TimeWithOffset} for the + # time zone as the first element and the current {TimezonePeriod} for the + # time zone as the second element. + def current_time_and_period + period = nil + + local_time = Timestamp.for(Time.now) do |ts| + period = period_for(ts) + TimestampWithOffset.set_timezone_offset(ts, period.offset) + end + + [local_time, period] + end + alias current_period_and_time current_time_and_period + + # Converts a time to local time for the time zone and returns a `String` + # representation of the local time according to the given format. + # + # `Timezone#strftime` first expands any occurrences of `%Z` in the format + # string to the time zone abbreviation for the local time (for example, EST + # or EDT). Depending on the type of `time` parameter, the result of the + # expansion is then passed to either `Time#strftime`, `DateTime#strftime` or + # `Timestamp#strftime` to handle any other format directives. + # + # This method is equivalent to the following: + # + # time_zone.to_local(time).strftime(format) + # + # @param format [String] the format string. + # @param time [Object] a `Time`, `DateTime` or `Timestamp`. + # @return [String] the formatted local time. + # @raise [ArgumentError] if `format` or `time` is `nil`. + # @raise [ArgumentError] if `time` is a {Timestamp} with an unspecified UTC + # offset. + def strftime(format, time = Time.now) + to_local(time).strftime(format) + end + + # @param time [Object] a `Time`, `DateTime` or `Timestamp`. + # @return [String] the abbreviation of this {Timezone} at the given time. + # @raise [ArgumentError] if `time` is `nil`. + # @raise [ArgumentError] if `time` is a {Timestamp} with an unspecified UTC + # offset. + def abbreviation(time = Time.now) + period_for(time).abbreviation + end + alias abbr abbreviation + + # @param time [Object] a `Time`, `DateTime` or `Timestamp`. + # @return [Boolean] whether daylight savings time is in effect at the given + # time. + # @raise [ArgumentError] if `time` is `nil`. + # @raise [ArgumentError] if `time` is a {Timestamp} with an unspecified UTC + # offset. + def dst?(time = Time.now) + period_for(time).dst? + end + + # Returns the base offset from UTC in seconds at the given time. This does + # not include any adjustment made for daylight savings time and will + # typically remain constant throughout the year. + # + # To obtain the observed offset from UTC, including the effect of daylight + # savings time, use {observed_utc_offset} instead. + # + # If you require accurate {base_utc_offset} values, you should install the + # tzinfo-data gem and set {DataSources::RubyDataSource} as the {DataSource}. + # When using {DataSources::ZoneinfoDataSource}, the value of + # {base_utc_offset} has to be derived from changes to the observed UTC + # offset and DST status since it is not included in zoneinfo files. + # + # @param time [Object] a `Time`, `DateTime` or `Timestamp`. + # @return [Integer] the base offset from UTC in seconds at the given time. + # @raise [ArgumentError] if `time` is `nil`. + # @raise [ArgumentError] if `time` is a {Timestamp} with an unspecified UTC + # offset. + def base_utc_offset(time = Time.now) + period_for(time).base_utc_offset + end + + # Returns the observed offset from UTC in seconds at the given time. This + # includes adjustments made for daylight savings time. + # + # @param time [Object] a `Time`, `DateTime` or `Timestamp`. + # @return [Integer] the observed offset from UTC in seconds at the given + # time. + # @raise [ArgumentError] if `time` is `nil`. + # @raise [ArgumentError] if `time` is a {Timestamp} with an unspecified UTC + # offset. + def observed_utc_offset(time = Time.now) + period_for(time).observed_utc_offset + end + alias utc_offset observed_utc_offset + + # Compares this {Timezone} with another based on the {identifier}. + # + # @param tz [Object] an `Object` to compare this {Timezone} with. + # @return [Integer] -1 if `tz` is less than `self`, 0 if `tz` is equal to + # `self` and +1 if `tz` is greater than `self`, or `nil` if `tz` is not an + # instance of {Timezone}. + def <=>(tz) + return nil unless tz.is_a?(Timezone) + identifier <=> tz.identifier + end + + # @param tz [Object] an `Object` to compare this {Timezone} with. + # @return [Boolean] `true` if `tz` is an instance of {Timezone} and has the + # same {identifier} as `self`, otherwise `false`. + def eql?(tz) + self == tz + end + + # @return [Integer] a hash based on the {identifier}. + def hash + identifier.hash + end + + # Matches `regexp` against the {identifier} of this {Timezone}. + # + # @param regexp [Regexp] a `Regexp` to match against the {identifier} of + # this {Timezone}. + # @return [Integer] the position the match starts, or `nil` if there is no + # match. + def =~(regexp) + regexp =~ identifier + end + + # Returns a serialized representation of this {Timezone}. This method is + # called when using `Marshal.dump` with an instance of {Timezone}. + # + # @param limit [Integer] the maximum depth to dump - ignored. + # @return [String] a serialized representation of this {Timezone}. + def _dump(limit) + identifier + end + + # Loads a {Timezone} from the serialized representation returned by {_dump}. + # This is method is called when using `Marshal.load` or `Marshal.restore` + # to restore a serialized {Timezone}. + # + # @param data [String] a serialized representation of a {Timezone}. + # @return [Timezone] the result of converting `data` back into a {Timezone}. + def self._load(data) + Timezone.get(data) + end + + private + + # Raises an {UnknownTimezone} exception. + # + # @raise [UnknownTimezone] always. + def raise_unknown_timezone + raise UnknownTimezone, 'TZInfo::Timezone should not be constructed directly (use TZInfo::Timezone.get instead)' + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timezone_offset.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timezone_offset.rb new file mode 100644 index 0000000000..25c98c38ac --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timezone_offset.rb @@ -0,0 +1,111 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + # Represents an offset from UTC observed by a time zone. + class TimezoneOffset + # Returns the base offset from UTC in seconds (`observed_utc_offset - + # std_offset`). This does not include any adjustment made for daylight + # savings time and will typically remain constant throughout the year. + # + # To obtain the currently observed offset from UTC, including the effect of + # daylight savings time, use {observed_utc_offset} instead. + # + # If you require accurate {base_utc_offset} values, you should install the + # tzinfo-data gem and set {DataSources::RubyDataSource} as the {DataSource}. + # When using {DataSources::ZoneinfoDataSource}, the value of + # {base_utc_offset} has to be derived from changes to the observed UTC + # offset and DST status since it is not included in zoneinfo files. + # + # @return [Integer] the base offset from UTC in seconds. + attr_reader :base_utc_offset + alias utc_offset base_utc_offset + + # Returns the offset from the time zone's standard time in seconds + # (`observed_utc_offset - base_utc_offset`). Zero when daylight savings time + # is not in effect. Non-zero (usually 3600 = 1 hour) if daylight savings is + # being observed. + # + # If you require accurate {std_offset} values, you should install the + # tzinfo-data gem and set {DataSources::RubyDataSource} as the {DataSource}. + # When using {DataSources::ZoneinfoDataSource}, the value of {std_offset} + # has to be derived from changes to the observed UTC offset and DST status + # since it is not included in zoneinfo files. + # + # @return [Integer] the offset from the time zone's standard time in + # seconds. + attr_reader :std_offset + + # Returns the observed offset from UTC in seconds (`base_utc_offset + + # std_offset`). This includes adjustments made for daylight savings time. + # + # @return [Integer] the observed offset from UTC in seconds. + attr_reader :observed_utc_offset + alias utc_total_offset observed_utc_offset + + # The abbreviation that identifies this offset. For example GMT + # (Greenwich Mean Time) or BST (British Summer Time) for Europe/London. + # + # @return [String] the abbreviation that identifies this offset. + attr_reader :abbreviation + alias abbr abbreviation + + # Initializes a new {TimezoneOffset}. + # + # {TimezoneOffset} instances should not normally be constructed manually. + # + # The passed in `abbreviation` instance will be frozen. + # + # @param base_utc_offset [Integer] the base offset from UTC in seconds. + # @param std_offset [Integer] the offset from standard time in seconds. + # @param abbreviation [String] the abbreviation identifying the offset. + def initialize(base_utc_offset, std_offset, abbreviation) + @base_utc_offset = base_utc_offset + @std_offset = std_offset + @abbreviation = abbreviation.freeze + + @observed_utc_offset = @base_utc_offset + @std_offset + end + + # Determines if daylight savings is in effect (i.e. if {std_offset} is + # non-zero). + # + # @return [Boolean] `true` if {std_offset} is non-zero, otherwise `false`. + def dst? + @std_offset != 0 + end + + # Determines if this {TimezoneOffset} is equal to another instance. + # + # @param toi [Object] the instance to test for equality. + # @return [Boolean] `true` if `toi` is a {TimezoneOffset} with the same + # {utc_offset}, {std_offset} and {abbreviation} as this {TimezoneOffset}, + # otherwise `false`. + def ==(toi) + toi.kind_of?(TimezoneOffset) && + base_utc_offset == toi.base_utc_offset && std_offset == toi.std_offset && abbreviation == toi.abbreviation + end + + # Determines if this {TimezoneOffset} is equal to another instance. + # + # @param toi [Object] the instance to test for equality. + # @return [Boolean] `true` if `toi` is a {TimezoneOffset} with the same + # {utc_offset}, {std_offset} and {abbreviation} as this {TimezoneOffset}, + # otherwise `false`. + def eql?(toi) + self == toi + end + + # @return [Integer] a hash based on {utc_offset}, {std_offset} and + # {abbreviation}. + def hash + [@base_utc_offset, @std_offset, @abbreviation].hash + end + + # @return [String] the internal object state as a programmer-readable + # `String`. + def inspect + "#<#{self.class}: @base_utc_offset=#{@base_utc_offset}, @std_offset=#{@std_offset}, @abbreviation=#{@abbreviation}>" + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timezone_period.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timezone_period.rb new file mode 100644 index 0000000000..a2cc985a94 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timezone_period.rb @@ -0,0 +1,179 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + # {TimezonePeriod} represents a period of time for a time zone where the same + # offset from UTC applies. It provides access to the observed offset, time + # zone abbreviation, start time and end time. + # + # The period of time can be unbounded at the start, end, or both the start + # and end. + # + # @abstract Time zone period data will returned as an instance of one of the + # subclasses of {TimezonePeriod}. + class TimezonePeriod + # @return [TimezoneOffset] the offset that applies in the period of time. + attr_reader :offset + + # Initializes a {TimezonePeriod}. + # + # @param offset [TimezoneOffset] the offset that is observed for the period + # of time. + # @raise [ArgumentError] if `offset` is `nil`. + def initialize(offset) + raise ArgumentError, 'offset must be specified' unless offset + @offset = offset + end + + # @return [TimezoneTransition] the transition that defines the start of this + # {TimezonePeriod} (`nil` if the start is unbounded). + def start_transition + raise_not_implemented(:start_transition) + end + + # @return [TimezoneTransition] the transition that defines the end of this + # {TimezonePeriod} (`nil` if the end is unbounded). + def end_transition + raise_not_implemented(:end_transition) + end + + # Returns the base offset from UTC in seconds (`observed_utc_offset - + # std_offset`). This does not include any adjustment made for daylight + # savings time and will typically remain constant throughout the year. + # + # To obtain the currently observed offset from UTC, including the effect of + # daylight savings time, use {observed_utc_offset} instead. + # + # If you require accurate {base_utc_offset} values, you should install the + # tzinfo-data gem and set {DataSources::RubyDataSource} as the {DataSource}. + # When using {DataSources::ZoneinfoDataSource}, the value of + # {base_utc_offset} has to be derived from changes to the observed UTC + # offset and DST status since it is not included in zoneinfo files. + # + # @return [Integer] the base offset from UTC in seconds. + def base_utc_offset + @offset.base_utc_offset + end + alias utc_offset base_utc_offset + + # Returns the offset from the time zone's standard time in seconds + # (`observed_utc_offset - base_utc_offset`). Zero when daylight savings time + # is not in effect. Non-zero (usually 3600 = 1 hour) if daylight savings is + # being observed. + # + # If you require accurate {std_offset} values, you should install the + # tzinfo-data gem and set {DataSources::RubyDataSource} as the {DataSource}. + # When using {DataSources::ZoneinfoDataSource}, the value of {std_offset} + # has to be derived from changes to the observed UTC offset and DST status + # since it is not included in zoneinfo files. + # + # @return [Integer] the offset from the time zone's standard time in + # seconds. + def std_offset + @offset.std_offset + end + + # The abbreviation that identifies this offset. For example GMT + # (Greenwich Mean Time) or BST (British Summer Time) for Europe/London. + # + # @return [String] the abbreviation that identifies this offset. + def abbreviation + @offset.abbreviation + end + alias abbr abbreviation + alias zone_identifier abbreviation + + # Returns the observed offset from UTC in seconds (`base_utc_offset + + # std_offset`). This includes adjustments made for daylight savings time. + # + # @return [Integer] the observed offset from UTC in seconds. + def observed_utc_offset + @offset.observed_utc_offset + end + alias utc_total_offset observed_utc_offset + + # Determines if daylight savings is in effect (i.e. if {std_offset} is + # non-zero). + # + # @return [Boolean] `true` if {std_offset} is non-zero, otherwise `false`. + def dst? + @offset.dst? + end + + # Returns the UTC start time of the period or `nil` if the start of the + # period is unbounded. + # + # The result is returned as a {Timestamp}. To obtain the start time as a + # `Time` or `DateTime`, call either {Timestamp#to_time to_time} or + # {Timestamp#to_datetime to_datetime} on the result. + # + # @return [Timestamp] the UTC start time of the period or `nil` if the start + # of the period is unbounded. + def starts_at + timestamp(start_transition) + end + + # Returns the UTC end time of the period or `nil` if the end of the period + # is unbounded. + # + # The result is returned as a {Timestamp}. To obtain the end time as a + # `Time` or `DateTime`, call either {Timestamp#to_time to_time} or + # {Timestamp#to_datetime to_datetime} on the result. + # + # @return [Timestamp] the UTC end time of the period or `nil` if the end of + # the period is unbounded. + def ends_at + timestamp(end_transition) + end + + # Returns the local start time of the period or `nil` if the start of the + # period is unbounded. + # + # The result is returned as a {TimestampWithOffset}. To obtain the start + # time as a `Time` or `DateTime`, call either {TimestampWithOffset#to_time + # to_time} or {TimestampWithOffset#to_datetime to_datetime} on the result. + # + # @return [TimestampWithOffset] the local start time of the period or `nil` + # if the start of the period is unbounded. + def local_starts_at + timestamp_with_offset(start_transition) + end + + # Returns the local end time of the period or `nil` if the end of the period + # is unbounded. + # + # The result is returned as a {TimestampWithOffset}. To obtain the end time + # as a `Time` or `DateTime`, call either {TimestampWithOffset#to_time + # to_time} or {TimestampWithOffset#to_datetime to_datetime} on the result. + # + # @return [TimestampWithOffset] the local end time of the period or `nil` if + # the end of the period is unbounded. + def local_ends_at + timestamp_with_offset(end_transition) + end + + private + + # Raises a {NotImplementedError} to indicate that subclasses should override + # a method. + # + # @raise [NotImplementedError] always. + def raise_not_implemented(method_name) + raise NotImplementedError, "Subclasses must override #{method_name}" + end + + # @param transition [TimezoneTransition] a transition or `nil`. + # @return [Timestamp] the {Timestamp} representing when a transition occurs, + # or `nil` if `transition` is `nil`. + def timestamp(transition) + transition ? transition.at : nil + end + + # @param transition [TimezoneTransition] a transition or `nil`. + # @return [TimestampWithOffset] a {Timestamp} representing when a transition + # occurs with offset set to {#offset}, or `nil` if `transition` is `nil`. + def timestamp_with_offset(transition) + transition ? TimestampWithOffset.set_timezone_offset(transition.at, offset) : nil + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timezone_proxy.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timezone_proxy.rb new file mode 100644 index 0000000000..749f8408de --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timezone_proxy.rb @@ -0,0 +1,96 @@ +# encoding: UTF-8 + +module TZInfo + + # A proxy class standing in for a {Timezone} with a given identifier. + # {TimezoneProxy} inherits from {Timezone} and can be treated identically to + # {Timezone} instances loaded with {Timezone.get}. + # + # {TimezoneProxy} instances are used to avoid the performance overhead of + # loading time zone data into memory, for example, by {Timezone.all}. + # + # The first time an attempt is made to access the data for the time zone, the + # real {Timezone} will be loaded is loaded. If the proxy's identifier was not + # valid, then an exception will be raised at this point. + class TimezoneProxy < Timezone + # Initializes a new {TimezoneProxy}. + # + # The `identifier` parameter is not checked when initializing the proxy. It + # will be validated when the real {Timezone} instance is loaded. + # + # @param identifier [String] an IANA Time Zone Database time zone + # identifier. + def initialize(identifier) + super() + @identifier = identifier + @real_timezone = nil + end + + # (see Timezone#identifier) + def identifier + @real_timezone ? @real_timezone.identifier : @identifier + end + + # (see Timezone#period_for) + def period_for(time) + real_timezone.period_for_utc(time) + end + + # (see Timezone#periods_for_local) + def periods_for_local(local_time) + real_timezone.periods_for_local(local_time) + end + + # (see Timezone#transitions_up_to) + def transitions_up_to(to, from = nil) + real_timezone.transitions_up_to(to, from) + end + + # (see Timezone#canonical_zone) + def canonical_zone + real_timezone.canonical_zone + end + + # Returns a serialized representation of this {TimezoneProxy}. This method + # is called when using `Marshal.dump` with an instance of {TimezoneProxy}. + # + # @param limit [Integer] the maximum depth to dump - ignored. @return + # [String] a serialized representation of this {TimezoneProxy}. + # @return [String] a serialized representation of this {TimezoneProxy}. + def _dump(limit) + identifier + end + + # Loads a {TimezoneProxy} from the serialized representation returned by + # {_dump}. This is method is called when using `Marshal.load` or + # `Marshal.restore` to restore a serialized {Timezone}. + # + # @param data [String] a serialized representation of a {TimezoneProxy}. + # @return [TimezoneProxy] the result of converting `data` back into a + # {TimezoneProxy}. + def self._load(data) + TimezoneProxy.new(data) + end + + private + + # Returns the real {Timezone} instance being proxied. + # + # The real {Timezone} is loaded using {Timezone.get} on the first access. + # + # @return [Timezone] the real {Timezone} instance being proxied. + def real_timezone + # Thread-safety: It is possible that the value of @real_timezone may be + # calculated multiple times in concurrently executing threads. It is not + # worth the overhead of locking to ensure that @real_timezone is only + # calculated once. + unless @real_timezone + result = Timezone.get(@identifier) + return result if frozen? + @real_timezone = result + end + + @real_timezone + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timezone_transition.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timezone_transition.rb new file mode 100644 index 0000000000..db75b2330f --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/timezone_transition.rb @@ -0,0 +1,98 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + # Represents a transition from one observed UTC offset ({TimezoneOffset} to + # another for a time zone. + class TimezoneTransition + # @return [TimezoneOffset] the offset this transition changes to. + attr_reader :offset + + # @return [TimezoneOffset] the offset this transition changes from. + attr_reader :previous_offset + + # When this transition occurs as an `Integer` number of seconds since + # 1970-01-01 00:00:00 UTC ignoring leap seconds (i.e. each day is treated as + # if it were 86,400 seconds long). Equivalent to the result of calling the + # {Timestamp#value value} method on the {Timestamp} returned by {at}. + # + # @return [Integer] when this transition occurs as a number of seconds since + # 1970-01-01 00:00:00 UTC ignoring leap seconds. + attr_reader :timestamp_value + + # Initializes a new {TimezoneTransition}. + # + # {TimezoneTransition} instances should not normally be constructed + # manually. + # + # @param offset [TimezoneOffset] the offset the transition changes to. + # @param previous_offset [TimezoneOffset] the offset the transition changes + # from. + # @param timestamp_value [Integer] when the transition occurs as a + # number of seconds since 1970-01-01 00:00:00 UTC ignoring leap seconds + # (i.e. each day is treated as if it were 86,400 seconds long). + def initialize(offset, previous_offset, timestamp_value) + @offset = offset + @previous_offset = previous_offset + @timestamp_value = timestamp_value + end + + # Returns a {Timestamp} instance representing the UTC time when this + # transition occurs. + # + # To obtain the result as a `Time` or `DateTime`, call either + # {Timestamp#to_time to_time} or {Timestamp#to_datetime to_datetime} on the + # {Timestamp} instance that is returned. + # + # @return [Timestamp] the UTC time when this transition occurs. + def at + Timestamp.utc(@timestamp_value) + end + + # Returns a {TimestampWithOffset} instance representing the local time when + # this transition causes the previous observance to end (calculated from + # {at} using {previous_offset}). + # + # To obtain the result as a `Time` or `DateTime`, call either + # {TimestampWithOffset#to_time to_time} or {TimestampWithOffset#to_datetime + # to_datetime} on the {TimestampWithOffset} instance that is returned. + # + # @return [TimestampWithOffset] the local time when this transition causes + # the previous observance to end. + def local_end_at + TimestampWithOffset.new(@timestamp_value, 0, @previous_offset.observed_utc_offset).set_timezone_offset(@previous_offset) + end + + # Returns a {TimestampWithOffset} instance representing the local time when + # this transition causes the next observance to start (calculated from {at} + # using {offset}). + # + # To obtain the result as a `Time` or `DateTime`, call either + # {TimestampWithOffset#to_time to_time} or {TimestampWithOffset#to_datetime + # to_datetime} on the {TimestampWithOffset} instance that is returned. + # + # @return [TimestampWithOffset] the local time when this transition causes + # the next observance to start. + def local_start_at + TimestampWithOffset.new(@timestamp_value, 0, @offset.observed_utc_offset).set_timezone_offset(@offset) + end + + # Determines if this {TimezoneTransition} is equal to another instance. + # + # @param tti [Object] the instance to test for equality. + # @return [Boolean] `true` if `tti` is a {TimezoneTransition} with the same + # {offset}, {previous_offset} and {timestamp_value} as this + # {TimezoneTransition}, otherwise `false`. + def ==(tti) + tti.kind_of?(TimezoneTransition) && + offset == tti.offset && previous_offset == tti.previous_offset && timestamp_value == tti.timestamp_value + end + alias eql? == + + # @return [Integer] a hash based on {offset}, {previous_offset} and + # {timestamp_value}. + def hash + [@offset, @previous_offset, @timestamp_value].hash + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/transition_rule.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/transition_rule.rb new file mode 100644 index 0000000000..58ef5684fe --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/transition_rule.rb @@ -0,0 +1,455 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + # Base class for rules definining the transition between standard and daylight + # savings time. + # + # @abstract + # @private + class TransitionRule #:nodoc: + # Returns the number of seconds after midnight local time on the day + # identified by the rule at which the transition occurs. Can be negative to + # denote a time on the prior day. Can be greater than or equal to 86,400 to + # denote a time of the following day. + # + # @return [Integer] the time in seconds after midnight local time at which + # the transition occurs. + attr_reader :transition_at + + # Initializes a new {TransitionRule}. + # + # @param transition_at [Integer] the time in seconds after midnight local + # time at which the transition occurs. + # @raise [ArgumentError] if `transition_at` is not an `Integer`. + def initialize(transition_at) + raise ArgumentError, 'Invalid transition_at' unless transition_at.kind_of?(Integer) + @transition_at = transition_at + end + + # Calculates the time of the transition from a given offset on a given year. + # + # @param offset [TimezoneOffset] the current offset at the time the rule + # will transition. + # @param year [Integer] the year in which the transition occurs (local + # time). + # @return [TimestampWithOffset] the time at which the transition occurs. + def at(offset, year) + day = get_day(offset, year) + TimestampWithOffset.set_timezone_offset(Timestamp.for(day + @transition_at), offset) + end + + # Determines if this {TransitionRule} is equal to another instance. + # + # @param r [Object] the instance to test for equality. + # @return [Boolean] `true` if `r` is a {TransitionRule} with the same + # {transition_at} as this {TransitionRule}, otherwise `false`. + def ==(r) + r.kind_of?(TransitionRule) && @transition_at == r.transition_at + end + alias eql? == + + # @return [Integer] a hash based on {hash_args} (defaulting to + # {transition_at}). + def hash + hash_args.hash + end + + protected + + # @return [Array] an `Array` of parameters that will influence the output of + # {hash}. + def hash_args + [@transition_at] + end + end + private_constant :TransitionRule + + # A base class for transition rules that activate based on an integer day of + # the year. + # + # @abstract + # @private + class DayOfYearTransitionRule < TransitionRule #:nodoc: + # Initializes a new {DayOfYearTransitionRule}. + # + # @param day [Integer] the day of the year on which the transition occurs. + # The precise meaning is defined by subclasses. + # @param transition_at [Integer] the time in seconds after midnight local + # time at which the transition occurs. + # @raise [ArgumentError] if `transition_at` is not an `Integer`. + # @raise [ArgumentError] if `day` is not an `Integer`. + def initialize(day, transition_at) + super(transition_at) + raise ArgumentError, 'Invalid day' unless day.kind_of?(Integer) + @seconds = day * 86400 + end + + # Determines if this {DayOfYearTransitionRule} is equal to another instance. + # + # @param r [Object] the instance to test for equality. + # @return [Boolean] `true` if `r` is a {DayOfYearTransitionRule} with the + # same {transition_at} and day as this {DayOfYearTransitionRule}, + # otherwise `false`. + def ==(r) + super(r) && r.kind_of?(DayOfYearTransitionRule) && @seconds == r.seconds + end + alias eql? == + + protected + + # @return [Integer] the day multipled by the number of seconds in a day. + attr_reader :seconds + + # (see TransitionRule#hash_args) + def hash_args + [@seconds] + super + end + end + private_constant :DayOfYearTransitionRule + + # Defines transitions that occur on the zero-based nth day of the year. + # + # Day 0 is 1 January. + # + # Leap days are counted. Day 59 will be 29 February on a leap year and 1 March + # on a non-leap year. Day 365 will be 31 December on a leap year and 1 January + # the following year on a non-leap year. + # + # @private + class AbsoluteDayOfYearTransitionRule < DayOfYearTransitionRule #:nodoc: + # Initializes a new {AbsoluteDayOfYearTransitionRule}. + # + # @param day [Integer] the zero-based day of the year on which the + # transition occurs (0 to 365 inclusive). + # @param transition_at [Integer] the time in seconds after midnight local + # time at which the transition occurs. + # @raise [ArgumentError] if `transition_at` is not an `Integer`. + # @raise [ArgumentError] if `day` is not an `Integer`. + # @raise [ArgumentError] if `day` is less than 0 or greater than 365. + def initialize(day, transition_at = 0) + super(day, transition_at) + raise ArgumentError, 'Invalid day' unless day >= 0 && day <= 365 + end + + # @return [Boolean] `true` if the day specified by this transition is the + # first in the year (a day number of 0), otherwise `false`. + def is_always_first_day_of_year? + seconds == 0 + end + + # @return [Boolean] `false`. + def is_always_last_day_of_year? + false + end + + # Determines if this {AbsoluteDayOfYearTransitionRule} is equal to another + # instance. + # + # @param r [Object] the instance to test for equality. + # @return [Boolean] `true` if `r` is a {AbsoluteDayOfYearTransitionRule} + # with the same {transition_at} and day as this + # {AbsoluteDayOfYearTransitionRule}, otherwise `false`. + def ==(r) + super(r) && r.kind_of?(AbsoluteDayOfYearTransitionRule) + end + alias eql? == + + protected + + # Returns a `Time` representing midnight local time on the day specified by + # the rule for the given offset and year. + # + # @param offset [TimezoneOffset] the current offset at the time of the + # transition. + # @param year [Integer] the year in which the transition occurs. + # @return [Time] midnight local time on the day specified by the rule for + # the given offset and year. + def get_day(offset, year) + Time.new(year, 1, 1, 0, 0, 0, offset.observed_utc_offset) + seconds + end + + # (see TransitionRule#hash_args) + def hash_args + [AbsoluteDayOfYearTransitionRule] + super + end + end + + # Defines transitions that occur on the one-based nth Julian day of the year. + # + # Leap days are not counted. Day 1 is 1 January. Day 60 is always 1 March. + # Day 365 is always 31 December. + # + # @private + class JulianDayOfYearTransitionRule < DayOfYearTransitionRule #:nodoc: + # The 60 days in seconds. + LEAP = 60 * 86400 + private_constant :LEAP + + # The length of a non-leap year in seconds. + YEAR = 365 * 86400 + private_constant :YEAR + + # Initializes a new {JulianDayOfYearTransitionRule}. + # + # @param day [Integer] the one-based Julian day of the year on which the + # transition occurs (1 to 365 inclusive). + # @param transition_at [Integer] the time in seconds after midnight local + # time at which the transition occurs. + # @raise [ArgumentError] if `transition_at` is not an `Integer`. + # @raise [ArgumentError] if `day` is not an `Integer`. + # @raise [ArgumentError] if `day` is less than 1 or greater than 365. + def initialize(day, transition_at = 0) + super(day, transition_at) + raise ArgumentError, 'Invalid day' unless day >= 1 && day <= 365 + end + + # @return [Boolean] `true` if the day specified by this transition is the + # first in the year (a day number of 1), otherwise `false`. + def is_always_first_day_of_year? + seconds == 86400 + end + + # @return [Boolean] `true` if the day specified by this transition is the + # last in the year (a day number of 365), otherwise `false`. + def is_always_last_day_of_year? + seconds == YEAR + end + + # Determines if this {JulianDayOfYearTransitionRule} is equal to another + # instance. + # + # @param r [Object] the instance to test for equality. + # @return [Boolean] `true` if `r` is a {JulianDayOfYearTransitionRule} with + # the same {transition_at} and day as this + # {JulianDayOfYearTransitionRule}, otherwise `false`. + def ==(r) + super(r) && r.kind_of?(JulianDayOfYearTransitionRule) + end + alias eql? == + + protected + + # Returns a `Time` representing midnight local time on the day specified by + # the rule for the given offset and year. + # + # @param offset [TimezoneOffset] the current offset at the time of the + # transition. + # @param year [Integer] the year in which the transition occurs. + # @return [Time] midnight local time on the day specified by the rule for + # the given offset and year. + def get_day(offset, year) + # Returns 1 March on non-leap years. + leap = Time.new(year, 2, 29, 0, 0, 0, offset.observed_utc_offset) + diff = seconds - LEAP + diff += 86400 if diff >= 0 && leap.mday == 29 + leap + diff + end + + # (see TransitionRule#hash_args) + def hash_args + [JulianDayOfYearTransitionRule] + super + end + end + private_constant :JulianDayOfYearTransitionRule + + # A base class for rules that transition on a particular day of week of a + # given week (subclasses specify which week of the month). + # + # @abstract + # @private + class DayOfWeekTransitionRule < TransitionRule #:nodoc: + # Initializes a new {DayOfWeekTransitionRule}. + # + # @param month [Integer] the month of the year when the transition occurs. + # @param day_of_week [Integer] the day of the week when the transition + # occurs. 0 is Sunday, 6 is Saturday. + # @param transition_at [Integer] the time in seconds after midnight local + # time at which the transition occurs. + # @raise [ArgumentError] if `transition_at` is not an `Integer`. + # @raise [ArgumentError] if `month` is not an `Integer`. + # @raise [ArgumentError] if `month` is less than 1 or greater than 12. + # @raise [ArgumentError] if `day_of_week` is not an `Integer`. + # @raise [ArgumentError] if `day_of_week` is less than 0 or greater than 6. + def initialize(month, day_of_week, transition_at) + super(transition_at) + raise ArgumentError, 'Invalid month' unless month.kind_of?(Integer) && month >= 1 && month <= 12 + raise ArgumentError, 'Invalid day_of_week' unless day_of_week.kind_of?(Integer) && day_of_week >= 0 && day_of_week <= 6 + @month = month + @day_of_week = day_of_week + end + + # @return [Boolean] `false`. + def is_always_first_day_of_year? + false + end + + # @return [Boolean] `false`. + def is_always_last_day_of_year? + false + end + + # Determines if this {DayOfWeekTransitionRule} is equal to another + # instance. + # + # @param r [Object] the instance to test for equality. + # @return [Boolean] `true` if `r` is a {DayOfWeekTransitionRule} with the + # same {transition_at}, month and day of week as this + # {DayOfWeekTransitionRule}, otherwise `false`. + def ==(r) + super(r) && r.kind_of?(DayOfWeekTransitionRule) && @month == r.month && @day_of_week == r.day_of_week + end + alias eql? == + + protected + + # @return [Integer] the month of the year (1 to 12). + attr_reader :month + + # @return [Integer] the day of the week (0 to 6 for Sunday to Monday). + attr_reader :day_of_week + + # (see TransitionRule#hash_args) + def hash_args + [@month, @day_of_week] + super + end + end + private_constant :DayOfWeekTransitionRule + + # A rule that transitions on the nth occurrence of a particular day of week + # of a calendar month. + # + # @private + class DayOfMonthTransitionRule < DayOfWeekTransitionRule #:nodoc: + # Initializes a new {DayOfMonthTransitionRule}. + # + # @param month [Integer] the month of the year when the transition occurs. + # @param week [Integer] the week of the month when the transition occurs (1 + # to 4). + # @param day_of_week [Integer] the day of the week when the transition + # occurs. 0 is Sunday, 6 is Saturday. + # @param transition_at [Integer] the time in seconds after midnight local + # time at which the transition occurs. + # @raise [ArgumentError] if `transition_at` is not an `Integer`. + # @raise [ArgumentError] if `month` is not an `Integer`. + # @raise [ArgumentError] if `month` is less than 1 or greater than 12. + # @raise [ArgumentError] if `week` is not an `Integer`. + # @raise [ArgumentError] if `week` is less than 1 or greater than 4. + # @raise [ArgumentError] if `day_of_week` is not an `Integer`. + # @raise [ArgumentError] if `day_of_week` is less than 0 or greater than 6. + def initialize(month, week, day_of_week, transition_at = 0) + super(month, day_of_week, transition_at) + raise ArgumentError, 'Invalid week' unless week.kind_of?(Integer) && week >= 1 && week <= 4 + @offset_start = (week - 1) * 7 + 1 + end + + # Determines if this {DayOfMonthTransitionRule} is equal to another + # instance. + # + # @param r [Object] the instance to test for equality. + # @return [Boolean] `true` if `r` is a {DayOfMonthTransitionRule} with the + # same {transition_at}, month, week and day of week as this + # {DayOfMonthTransitionRule}, otherwise `false`. + def ==(r) + super(r) && r.kind_of?(DayOfMonthTransitionRule) && @offset_start == r.offset_start + end + alias eql? == + + protected + + # @return [Integer] the day the week starts on for a month starting on a + # Sunday. + attr_reader :offset_start + + # Returns a `Time` representing midnight local time on the day specified by + # the rule for the given offset and year. + # + # @param offset [TimezoneOffset] the current offset at the time of the + # transition. + # @param year [Integer] the year in which the transition occurs. + # @return [Time] midnight local time on the day specified by the rule for + # the given offset and year. + def get_day(offset, year) + candidate = Time.new(year, month, @offset_start, 0, 0, 0, offset.observed_utc_offset) + diff = day_of_week - candidate.wday + + if diff < 0 + candidate + (7 + diff) * 86400 + elsif diff > 0 + candidate + diff * 86400 + else + candidate + end + end + + # (see TransitionRule#hash_args) + def hash_args + [@offset_start] + super + end + end + private_constant :DayOfMonthTransitionRule + + # A rule that transitions on the last occurrence of a particular day of week + # of a calendar month. + # + # @private + class LastDayOfMonthTransitionRule < DayOfWeekTransitionRule #:nodoc: + # Initializes a new {LastDayOfMonthTransitionRule}. + # + # @param month [Integer] the month of the year when the transition occurs. + # @param day_of_week [Integer] the day of the week when the transition + # occurs. 0 is Sunday, 6 is Saturday. + # @param transition_at [Integer] the time in seconds after midnight local + # time at which the transition occurs. + # @raise [ArgumentError] if `transition_at` is not an `Integer`. + # @raise [ArgumentError] if `month` is not an `Integer`. + # @raise [ArgumentError] if `month` is less than 1 or greater than 12. + # @raise [ArgumentError] if `day_of_week` is not an `Integer`. + # @raise [ArgumentError] if `day_of_week` is less than 0 or greater than 6. + def initialize(month, day_of_week, transition_at = 0) + super(month, day_of_week, transition_at) + end + + # Determines if this {LastDayOfMonthTransitionRule} is equal to another + # instance. + # + # @param r [Object] the instance to test for equality. + # @return [Boolean] `true` if `r` is a {LastDayOfMonthTransitionRule} with + # the same {transition_at}, month and day of week as this + # {LastDayOfMonthTransitionRule}, otherwise `false`. + def ==(r) + super(r) && r.kind_of?(LastDayOfMonthTransitionRule) + end + alias eql? == + + protected + + # Returns a `Time` representing midnight local time on the day specified by + # the rule for the given offset and year. + # + # @param offset [TimezoneOffset] the current offset at the time of the + # transition. + # @param year [Integer] the year in which the transition occurs. + # @return [Time] midnight local time on the day specified by the rule for + # the given offset and year. + def get_day(offset, year) + next_month = month + 1 + if next_month == 13 + year += 1 + next_month = 1 + end + + candidate = Time.new(year, next_month, 1, 0, 0, 0, offset.observed_utc_offset) - 86400 + diff = candidate.wday - day_of_week + + if diff < 0 + candidate - (diff + 7) * 86400 + elsif diff > 0 + candidate - diff * 86400 + else + candidate + end + end + end + private_constant :LastDayOfMonthTransitionRule +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/transitions_timezone_period.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/transitions_timezone_period.rb new file mode 100644 index 0000000000..aea87f33fb --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/transitions_timezone_period.rb @@ -0,0 +1,63 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + # Represents a period of time in a time zone where the same offset from UTC + # applies. The period of time is bounded at at least one end, either having a + # start transition, end transition or both start and end transitions. + class TransitionsTimezonePeriod < TimezonePeriod + # @return [TimezoneTransition] the transition that defines the start of this + # {TimezonePeriod} (`nil` if the start is unbounded). + attr_reader :start_transition + + # @return [TimezoneTransition] the transition that defines the end of this + # {TimezonePeriod} (`nil` if the end is unbounded). + attr_reader :end_transition + + # Initializes a {TransitionsTimezonePeriod}. + # + # At least one of `start_transition` and `end_transition` must be specified. + # + # @param start_transition [TimezoneTransition] the transition that defines + # the start of the period, or `nil` if the start is unbounded. + # @param end_transition [TimezoneTransition] the transition that defines the + # end of the period, or `nil` if the end is unbounded. + # @raise [ArgumentError] if both `start_transition` and `end_transition` are + # `nil`. + def initialize(start_transition, end_transition) + if start_transition + super(start_transition.offset) + elsif end_transition + super(end_transition.previous_offset) + else + raise ArgumentError, 'At least one of start_transition and end_transition must be specified' + end + + @start_transition = start_transition + @end_transition = end_transition + end + + # Determines if this {TransitionsTimezonePeriod} is equal to another + # instance. + # + # @param p [Object] the instance to test for equality. + # @return [Boolean] `true` if `p` is a {TransitionsTimezonePeriod} with the + # same {offset}, {start_transition} and {end_transition}, otherwise + # `false`. + def ==(p) + p.kind_of?(TransitionsTimezonePeriod) && start_transition == p.start_transition && end_transition == p.end_transition + end + alias eql? == + + # @return [Integer] a hash based on {start_transition} and {end_transition}. + def hash + [@start_transition, @end_transition].hash + end + + # @return [String] the internal object state as a programmer-readable + # `String`. + def inspect + "#<#{self.class}: @start_transition=#{@start_transition.inspect}, @end_transition=#{@end_transition.inspect}>" + end + end +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/untaint_ext.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/untaint_ext.rb new file mode 100644 index 0000000000..4e8d0c078a --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/untaint_ext.rb @@ -0,0 +1,18 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + # Object#untaint is deprecated in Ruby >= 2.7 and will be removed in 3.2. + # UntaintExt adds a refinement to make Object#untaint a no-op and avoid the + # warning. + # + # @private + module UntaintExt # :nodoc: + refine Object do + def untaint + self + end + end + end + private_constant :UntaintExt +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/version.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/version.rb new file mode 100644 index 0000000000..cbfb0f0ab8 --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/version.rb @@ -0,0 +1,7 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + # The TZInfo version number. + VERSION = '2.0.3' +end diff --git a/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/with_offset.rb b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/with_offset.rb new file mode 100644 index 0000000000..3f2d9b05ca --- /dev/null +++ b/Library/Homebrew/vendor/bundle/ruby/2.6.0/gems/tzinfo-2.0.3/lib/tzinfo/with_offset.rb @@ -0,0 +1,61 @@ +# encoding: UTF-8 +# frozen_string_literal: true + +module TZInfo + # The {WithOffset} module is included in {TimeWithOffset}, + # {DateTimeWithOffset} and {TimestampWithOffset}. It provides an override for + # the {strftime} method that handles expanding the `%Z` directive according to + # the {TimezoneOffset#abbreviation abbreviation} of the {TimezoneOffset} + # associated with a local time. + module WithOffset + # Overrides the `Time`, `DateTime` or {Timestamp} version of `strftime`, + # replacing `%Z` with the {TimezoneOffset#abbreviation abbreviation} of the + # associated {TimezoneOffset}. If there is no associated offset, `%Z` is + # expanded by the base class instead. + # + # All the format directives handled by the base class are supported. + # + # @param format [String] the format string. + # @return [String] the formatted time. + # @raise [ArgumentError] if `format` is `nil`. + def strftime(format) + raise ArgumentError, 'format must be specified' unless format + + if_timezone_offset do |o| + abbreviation = nil + + format = format.gsub(/%(%*)Z/) do + if $1.length.odd? + # Return %%Z so the real strftime treats it as a literal %Z too. + "#$1%Z" + else + "#$1#{abbreviation ||= o.abbreviation.gsub(/%/, '%%')}" + end + end + end + + super + end + + protected + + # Performs a calculation if there is an associated {TimezoneOffset}. + # + # @param result [Object] a result value that can be manipulated by the block + # if there is an associated {TimezoneOffset}. + # @yield [period, result] if there is an associated {TimezoneOffset}, the + # block is yielded to in order to calculate the method result. + # @yieldparam period [TimezoneOffset] the associated {TimezoneOffset}. + # @yieldparam result [Object] the `result` parameter. + # @yieldreturn [Object] the result of the calculation performed if there is + # an associated {TimezoneOffset}. + # @return [Object] the result of the block if there is an associated + # {TimezoneOffset}, otherwise the `result` parameter. + # + # @private + def if_timezone_offset(result = nil) #:nodoc: + to = timezone_offset + to ? yield(to, result) : result + end + end +end