Skip to content

Commit fee72c3

Browse files
authored
Merge pull request rails#51640 from Shopify/prepend-to-include
Use `Module#include` rather than `prepend` for faster method lookup
2 parents 2323823 + 8e251a0 commit fee72c3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

activesupport/lib/active_support/core_ext/numeric/conversions.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,6 @@ def to_fs(format = nil, options = nil)
140140
end
141141
end
142142

143-
Integer.prepend ActiveSupport::NumericWithFormat
144-
Float.prepend ActiveSupport::NumericWithFormat
145-
BigDecimal.prepend ActiveSupport::NumericWithFormat
143+
Integer.include ActiveSupport::NumericWithFormat
144+
Float.include ActiveSupport::NumericWithFormat
145+
BigDecimal.include ActiveSupport::NumericWithFormat

activesupport/lib/active_support/core_ext/object/json.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def to_json(options = nil)
4646
end
4747

4848
[Enumerable, Object, Array, FalseClass, Float, Hash, Integer, NilClass, String, TrueClass].reverse_each do |klass|
49-
klass.prepend(ActiveSupport::ToJsonWithActiveSupportEncoder)
49+
klass.include(ActiveSupport::ToJsonWithActiveSupportEncoder)
5050
end
5151

5252
class Module

0 commit comments

Comments
 (0)