Sha256: 2ca0b737b54d7b8d176538ebc83dc0ee492bed2b599b58561242ad699798bdd3

Contents?: true

Size: 550 Bytes

Versions: 7

Compression:

Stored size: 550 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    # Common functionality for checking `rescue` nodes.
    module RescueNode
      def investigate(processed_source)
        @modifier_locations = processed_source
                              .tokens
                              .select { |t| t.type == :kRESCUE_MOD }
                              .map(&:pos)
      end

      def rescue_modifier?(node)
        node &&
          node.resbody_type? &&
          @modifier_locations.include?(node.loc.keyword)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubocop-0.52.0 lib/rubocop/cop/mixin/rescue_node.rb
rubocop-0.51.0 lib/rubocop/cop/mixin/rescue_node.rb
rubocop-0.50.0 lib/rubocop/cop/mixin/rescue_node.rb
rubocop-0.49.1 lib/rubocop/cop/mixin/rescue_node.rb
rubocop-0.49.0 lib/rubocop/cop/mixin/rescue_node.rb
rubocop-0.48.1 lib/rubocop/cop/mixin/rescue_node.rb
rubocop-0.48.0 lib/rubocop/cop/mixin/rescue_node.rb