1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

rubocop: fix offences of the Style/MissingRespondToMissing cop

This commit is contained in:
Kyrylo Silin 2019-03-23 13:56:00 +02:00
parent 0cbaf6d10d
commit 082691eb90
5 changed files with 14 additions and 10 deletions

View file

@ -208,11 +208,3 @@ Style/MethodMissingSuper:
- 'lib/pry/output.rb'
- 'lib/pry/plugins.rb'
- 'lib/pry/wrapped_module.rb'
# Offense count: 4
Style/MissingRespondToMissing:
Exclude:
- 'lib/pry/method.rb'
- 'lib/pry/method/disowned.rb'
- 'lib/pry/plugins.rb'
- 'lib/pry/wrapped_module.rb'

View file

@ -496,6 +496,10 @@ class Pry
@method.send(method_name, *args, &block)
end
def respond_to_missing?(method_name, include_private = false)
@method.respond_to?(method_name) || super
end
def comment
Pry::Code.from_file(source_file).comment_describing(source_line)
end

View file

@ -54,6 +54,10 @@ class Pry
Object.instance_method(:method_missing).bind(self)
.call(meth_name, *args, &block)
end
def respond_to_missing?(method_name, include_private = false)
!method(:name).respond_to?(method_name) || super
end
end
end
end

View file

@ -11,6 +11,10 @@ class Pry
def method_missing(*_args)
warn "Warning: The plugin '#{@name}' was not found! (no gem found)"
end
def respond_to_missing?(*)
false
end
end
class Plugin

View file

@ -149,8 +149,8 @@ class Pry
wrapped.send(method_name, *args, &block)
end
def respond_to?(method_name, include_all = false)
super || wrapped.respond_to?(method_name, include_all)
def respond_to_missing?(method_name, include_private = false)
wrapped.respond_to?(method_name, include_private) || super
end
# Retrieve the source location of a module. Return value is in same