Sha256: 140cf82314fdd3e79fa299384394101b710f9a746a9cc0411de8e7d03d2b615a

Contents?: true

Size: 726 Bytes

Versions: 6

Compression:

Stored size: 726 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module AST
    # A node extension for `resbody` nodes. This will be used in place of a
    # plain node when the builder constructs the AST, making its methods
    # available to all `resbody` nodes within RuboCop.
    class ResbodyNode < Node
      # Returns the body of the `rescue` clause.
      #
      # @return [Node, nil] The body of the `resbody`.
      def body
        node_parts[2]
      end

      # Custom destructuring method. This can be used to normalize
      # destructuring for different variations of the node.
      #
      # @return [Array<Node>] the different parts of the `resbody` statement
      def node_parts
        to_a
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rubocop-0.52.1 lib/rubocop/ast/node/resbody_node.rb
rubocop-0.52.0 lib/rubocop/ast/node/resbody_node.rb
rubocop-0.51.0 lib/rubocop/ast/node/resbody_node.rb
rubocop-0.50.0 lib/rubocop/ast/node/resbody_node.rb
rubocop-0.49.1 lib/rubocop/ast/node/resbody_node.rb
rubocop-0.49.0 lib/rubocop/ast/node/resbody_node.rb