Skip to content

Commit

Permalink
Replace Forwardable with ActiveSupport::Delegation
Browse files Browse the repository at this point in the history
ActiveSupport::Delegation accomplishes the same thing as Forwardable and
is already required in all frameworks through `active_support/rails`.
  • Loading branch information
skipkayhil committed Jan 12, 2025
1 parent 6f65662 commit dc11c50
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
5 changes: 1 addition & 4 deletions activemodel/lib/active_model/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
require "active_support/core_ext/object/deep_dup"
require "active_model/error"
require "active_model/nested_error"
require "forwardable"

module ActiveModel
# = Active \Model \Errors
Expand Down Expand Up @@ -61,8 +60,6 @@ module ActiveModel
class Errors
include Enumerable

extend Forwardable

##
# :method: each
#
Expand Down Expand Up @@ -100,7 +97,7 @@ class Errors
#
# Returns number of errors.

def_delegators :@errors, :each, :clear, :empty?, :size, :uniq!
delegate :each, :clear, :empty?, :size, :uniq!, to: :@errors

# The actual array of +Error+ objects
# This method is aliased to <tt>objects</tt>.
Expand Down
4 changes: 1 addition & 3 deletions activemodel/lib/active_model/nested_error.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# frozen_string_literal: true

require "active_model/error"
require "forwardable"

module ActiveModel
class NestedError < Error
Expand All @@ -16,7 +15,6 @@ def initialize(base, inner_error, override_options = {})

attr_reader :inner_error

extend Forwardable
def_delegators :@inner_error, :message
delegate :message, to: :@inner_error
end
end

0 comments on commit dc11c50

Please sign in to comment.