Skip to content

Commit dc11c50

Browse files
committed
Replace Forwardable with ActiveSupport::Delegation
ActiveSupport::Delegation accomplishes the same thing as Forwardable and is already required in all frameworks through `active_support/rails`.
1 parent 6f65662 commit dc11c50

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

activemodel/lib/active_model/errors.rb

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
require "active_support/core_ext/object/deep_dup"
66
require "active_model/error"
77
require "active_model/nested_error"
8-
require "forwardable"
98

109
module ActiveModel
1110
# = Active \Model \Errors
@@ -61,8 +60,6 @@ module ActiveModel
6160
class Errors
6261
include Enumerable
6362

64-
extend Forwardable
65-
6663
##
6764
# :method: each
6865
#
@@ -100,7 +97,7 @@ class Errors
10097
#
10198
# Returns number of errors.
10299

103-
def_delegators :@errors, :each, :clear, :empty?, :size, :uniq!
100+
delegate :each, :clear, :empty?, :size, :uniq!, to: :@errors
104101

105102
# The actual array of +Error+ objects
106103
# This method is aliased to <tt>objects</tt>.

activemodel/lib/active_model/nested_error.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# frozen_string_literal: true
22

33
require "active_model/error"
4-
require "forwardable"
54

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

1716
attr_reader :inner_error
1817

19-
extend Forwardable
20-
def_delegators :@inner_error, :message
18+
delegate :message, to: :@inner_error
2119
end
2220
end

0 commit comments

Comments
 (0)