module RuboCop::Cop::RescueNode
Common functionality for checking ‘rescue` nodes.
Public Instance Methods
on_new_investigation()
click to toggle source
# File lib/rubocop/cop/mixin/rescue_node.rb, line 7 def on_new_investigation @modifier_locations = processed_source.tokens.select(&:rescue_modifier?).map(&:pos) end
Private Instance Methods
rescue_modifier?(node)
click to toggle source
# File lib/rubocop/cop/mixin/rescue_node.rb, line 13 def rescue_modifier?(node) return false unless node.respond_to?(:resbody_type?) node.resbody_type? && @modifier_locations.include?(node.loc.keyword) end
rescued_exceptions(resbody)
click to toggle source
@deprecated Use ResbodyNode#exceptions instead
# File lib/rubocop/cop/mixin/rescue_node.rb, line 20 def rescued_exceptions(resbody) rescue_group, = *resbody if rescue_group rescue_group.values else [] end end