Skip to content

Commit 43b1fb8

Browse files
committed
Replace methods by singleton_methods when overriding them.
1 parent 49e8e63 commit 43b1fb8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/grape/api.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ module Grape
55
# should subclass this class in order to build an API.
66
class API
77
# Class methods that we want to call on the API rather than on the API object
8-
NON_OVERRIDABLE = %i[call call! configuration compile! inherited recognize_path].freeze
8+
NON_OVERRIDABLE = %i[call call! configuration compile! inherited recognize_path to_s].freeze
99

1010
Helpers = Grape::DSL::Helpers::BaseHelper
1111

@@ -51,7 +51,7 @@ def initial_setup(base_instance_parent)
5151

5252
# Redefines all methods so that are forwarded to add_setup and be recorded
5353
def override_all_methods!
54-
(base_instance.methods - Class.methods - NON_OVERRIDABLE).each do |method_override|
54+
(base_instance.singleton_methods - NON_OVERRIDABLE).each do |method_override|
5555
define_singleton_method(method_override) do |*args, &block|
5656
add_setup(method: method_override, args: args, block: block)
5757
end

0 commit comments

Comments
 (0)