Sha256: 3d457ce4e850385e79f53ccc6aae256f7ad2b6522843fd98c1df8c809f3be0ad
Contents?: true
Size: 1.09 KB
Versions: 2
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true module RuboCop module AST # A node extension for `ensure` nodes. This will be used in place of a plain # node when the builder constructs the AST, making its methods available # to all `ensure` nodes within RuboCop. class EnsureNode < Node # Returns the body of the `ensure` clause. # # @return [Node, nil] The body of the `ensure`. # @deprecated Use `EnsureNode#branch` def body branch end # Returns an the ensure branch in the exception handling statement. # # @return [Node, nil] the body of the ensure branch. def branch node_parts[1] end # Returns the `rescue` node of the `ensure`, if present. # # @return [Node, nil] The `rescue` node. def rescue_node node_parts[0] if node_parts[0].rescue_type? end # Checks whether this node body is a void context. # Always `true` for `ensure`. # # @return [true] whether the `ensure` node body is a void context def void_context? true end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rubocop-ast-1.36.2 | lib/rubocop/ast/node/ensure_node.rb |
rubocop-ast-1.36.1 | lib/rubocop/ast/node/ensure_node.rb |