File tree Expand file tree Collapse file tree 3 files changed +12
-2
lines changed
Expand file tree Collapse file tree 3 files changed +12
-2
lines changed Original file line number Diff line number Diff line change 99
1010#### Fixes
1111
12+ * [ #2328 ] ( https://github.com/ruby-grape/grape/pull/2328 ) : Don't cache Class.instance_methods - [ @byroot ] ( https://github.com/byroot ) .
1213* Your contribution here.
1314
1415## 1.7.1 (2023/05/14)
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ module Grape
88 # should subclass this class in order to build an API.
99 class API
1010 # Class methods that we want to call on the API rather than on the API object
11- NON_OVERRIDABLE = ( Class . new . methods + %i[ call call! configuration compile! inherited ] ) . freeze
11+ NON_OVERRIDABLE = %i[ call call! configuration compile! inherited ] . freeze
1212
1313 class Boolean
1414 def self . build ( val )
@@ -50,7 +50,7 @@ def initial_setup(base_instance_parent)
5050
5151 # Redefines all methods so that are forwarded to add_setup and be recorded
5252 def override_all_methods!
53- ( base_instance . methods - NON_OVERRIDABLE ) . each do |method_override |
53+ ( base_instance . methods - Class . methods - NON_OVERRIDABLE ) . each do |method_override |
5454 define_singleton_method ( method_override ) do |*args , &block |
5555 add_setup ( method_override , *args , &block )
5656 end
Original file line number Diff line number Diff line change @@ -4226,6 +4226,15 @@ def self.inherited(child_api)
42264226 end
42274227 end
42284228
4229+ it 'does not override methods inherited from Class' do
4230+ Class . define_method ( :test_method ) { }
4231+ subclass = Class . new ( described_class )
4232+ expect ( subclass ) . not_to receive ( :add_setup )
4233+ subclass . test_method
4234+ ensure
4235+ Class . remove_method ( :test_method )
4236+ end
4237+
42294238 context 'overriding via composition' do
42304239 module Inherited
42314240 def inherited ( api )
You can’t perform that action at this time.
0 commit comments