Class: Nitpick::Warnings::RescueValue
- Inherits:
-
SimpleWarning
- Object
- SimpleWarning
- Nitpick::Warnings::RescueValue
- Defined in:
- lib/nitpick/warnings/rescue_value.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ RescueValue
constructor
A new instance of RescueValue.
- #matches? ⇒ Boolean
- #message ⇒ Object
Methods inherited from SimpleWarning
Constructor Details
#initialize(*args) ⇒ RescueValue
Returns a new instance of RescueValue.
4 5 6 |
# File 'lib/nitpick/warnings/rescue_value.rb', line 4 def initialize(*args) @exceptions, *@rescue_value = args end |
Instance Method Details
#matches? ⇒ Boolean
8 9 10 11 12 13 14 15 |
# File 'lib/nitpick/warnings/rescue_value.rb', line 8 def matches? return false if @rescue_value.nil? return false if @rescue_value.size > 1 return false if @rescue_value.empty? val = @rescue_value.first return false if val.nil? or val.empty? [:lit, :nil].include? val.first # the value's type end |
#message ⇒ Object
17 18 19 |
# File 'lib/nitpick/warnings/rescue_value.rb', line 17 def "A rescue is returning #{sexp_to_ruby(@rescue_value.first).inspect} directly and may not handle an error." end |