Class: Nitpick::Warnings::RescueEverything

Inherits:
SimpleWarning show all
Defined in:
lib/nitpick/warnings/rescue_everything.rb

Instance Method Summary collapse

Methods inherited from SimpleWarning

#==, discover

Constructor Details

#initialize(*args) ⇒ RescueEverything

Returns a new instance of RescueEverything.



4
5
6
# File 'lib/nitpick/warnings/rescue_everything.rb', line 4

def initialize(*args)
  @exceptions, @rescue_value = args
end

Instance Method Details

#matches?Boolean

Returns:

  • (Boolean)


8
9
10
11
12
13
# File 'lib/nitpick/warnings/rescue_everything.rb', line 8

def matches?
  return false unless @exceptions
  [:Object, :Exception].find do |const|
    @exceptions.include? [:const, const]
  end
end

#messageObject



15
16
17
# File 'lib/nitpick/warnings/rescue_everything.rb', line 15

def message
  "A rescue is capturing Object or Exception, which may hide errors."
end