Sha256: b7f47bf1e93324fe4ac6aef9b6e78ea8a40392584e35b31c3789a2f9c3ec14ef

Contents?: true

Size: 741 Bytes

Versions: 6

Compression:

Stored size: 741 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module AST
    # A node extension for `lvasgn`, `ivasgn`, `cvasgn`, and `gvasgn` nodes.
    # This will be used in place of a plain node when the builder constructs
    # the AST, making its methods available to all assignment nodes within RuboCop.
    class AsgnNode < Node
      # The name of the variable being assigned as a symbol.
      #
      # @return [Symbol] the name of the variable being assigned
      def name
        node_parts[0]
      end
      alias lhs name

      # The expression being assigned to the variable.
      #
      # @return [Node] the expression being assigned.
      def expression
        node_parts[1]
      end
      alias rhs expression
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rubocop-ast-1.36.2 lib/rubocop/ast/node/asgn_node.rb
rubocop-ast-1.36.1 lib/rubocop/ast/node/asgn_node.rb
rubocop-ast-1.36.0 lib/rubocop/ast/node/asgn_node.rb
rubocop-ast-1.35.0 lib/rubocop/ast/node/asgn_node.rb
rubocop-ast-1.34.1 lib/rubocop/ast/node/asgn_node.rb
rubocop-ast-1.34.0 lib/rubocop/ast/node/asgn_node.rb