It may be better to explicitly require 'object/try' where we call `try`

In most cases it works now without explicit require because it's accidentally required through
active_support/core_ext/date_and_time/calculations.rb where we still call `try`,
but that would stop working if we changed the Calculations implementation and remove the require call there.
This commit is contained in:
Akira Matsuda 2019-08-01 18:43:25 +09:00
parent 03018cb79b
commit 530f7805ed
14 changed files with 21 additions and 0 deletions

View File

@ -1,5 +1,7 @@
# frozen_string_literal: true
require "active_support/core_ext/object/try"
module ActionController
module ConditionalGet
extend ActiveSupport::Concern

View File

@ -1,5 +1,6 @@
# frozen_string_literal: true
require "active_support/core_ext/object/try"
require "action_view/helpers/tags/placeholderable"
module ActionText

View File

@ -1,5 +1,7 @@
# frozen_string_literal: true
require "active_support/core_ext/object/try"
module ActionText
class Attachment
include Attachments::TrixConversion, Attachments::Minification, Attachments::Caching

View File

@ -1,5 +1,7 @@
# frozen_string_literal: true
require "active_support/core_ext/object/try"
module ActionText
module Attachments
module TrixConversion

View File

@ -1,5 +1,7 @@
# frozen_string_literal: true
require "active_support/core_ext/object/try"
module ActiveModel
module Type
class Float < Value # :nodoc:

View File

@ -1,5 +1,7 @@
# frozen_string_literal: true
require "active_support/core_ext/object/try"
module ActiveRecord
module AttributeMethods
module TimeZoneConversion

View File

@ -12,6 +12,7 @@ class ::PG::Connection # :nodoc:
end
end
require "active_support/core_ext/object/try"
require "active_record/connection_adapters/abstract_adapter"
require "active_record/connection_adapters/statement_pool"
require "active_record/connection_adapters/postgresql/column"

View File

@ -2,6 +2,7 @@
require "active_record"
require "rails"
require "active_support/core_ext/object/try"
require "active_model/railtie"
# For now, action_controller must always be present with

View File

@ -1,5 +1,7 @@
# frozen_string_literal: true
require "active_support/core_ext/object/try"
# Provides asynchronous mirroring of directly-uploaded blobs.
class ActiveStorage::MirrorJob < ActiveStorage::BaseJob
queue_as { ActiveStorage.queues[:mirror] }

View File

@ -1,5 +1,7 @@
# frozen_string_literal: true
require "active_support/core_ext/object/try"
module ActiveStorage
# Provides the class-level DSL for declaring an Active Record model's attachments.
module Attached::Model

View File

@ -6,6 +6,7 @@ require_relative "dummy/config/environment.rb"
require "bundler/setup"
require "active_support"
require "active_support/test_case"
require "active_support/core_ext/object/try"
require "active_support/testing/autorun"
require "active_storage/service/mirror_service"
require "image_processing/mini_magick"

View File

@ -5,6 +5,7 @@ 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"

View File

@ -3,6 +3,7 @@
require "mutex_m"
require "concurrent/map"
require "set"
require "active_support/core_ext/object/try"
module ActiveSupport
module Notifications

View File

@ -3,6 +3,7 @@
require "rails/railtie"
require "rails/engine/railties"
require "active_support/core_ext/module/delegation"
require "active_support/core_ext/object/try"
require "pathname"
require "thread"