123456789_123456789_123456789_123456789_123456789_

Class: Parser::AST::Node

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
RuboCop::AST::AliasNode, RuboCop::AST::AndAsgnNode, RuboCop::AST::AndNode, RuboCop::AST::ArgNode, RuboCop::AST::ArgsNode, RuboCop::AST::ArrayNode, RuboCop::AST::AsgnNode, RuboCop::AST::BlockNode, RuboCop::AST::BreakNode, RuboCop::AST::CaseMatchNode, RuboCop::AST::CaseNode, RuboCop::AST::CasgnNode, RuboCop::AST::ClassNode, RuboCop::AST::ComplexNode, RuboCop::AST::ConstNode, RuboCop::AST::CsendNode, RuboCop::AST::DefNode, RuboCop::AST::DefinedNode, RuboCop::AST::DstrNode, RuboCop::AST::EnsureNode, RuboCop::AST::FloatNode, RuboCop::AST::ForNode, RuboCop::AST::ForwardArgsNode, RuboCop::AST::HashNode, RuboCop::AST::IfNode, RuboCop::AST::InPatternNode, RuboCop::AST::IndexNode, RuboCop::AST::IndexasgnNode, RuboCop::AST::IntNode, RuboCop::AST::KeywordBeginNode, RuboCop::AST::KeywordSplatNode, RuboCop::AST::LambdaNode, RuboCop::AST::MasgnNode, RuboCop::AST::MlhsNode, RuboCop::AST::ModuleNode, RuboCop::AST::NextNode, RuboCop::AST::Node, RuboCop::AST::OpAsgnNode, RuboCop::AST::OrAsgnNode, RuboCop::AST::OrNode, RuboCop::AST::PairNode, RuboCop::AST::Procarg0Node, RuboCop::AST::RangeNode, RuboCop::AST::RationalNode, RuboCop::AST::RegexpNode, RuboCop::AST::ResbodyNode, RuboCop::AST::RescueNode, RuboCop::AST::ReturnNode, RuboCop::AST::SelfClassNode, RuboCop::AST::SendNode, RuboCop::AST::StrNode, RuboCop::AST::SuperNode, RuboCop::AST::SymbolNode, RuboCop::AST::UntilNode, RuboCop::AST::VarNode, RuboCop::AST::WhenNode, RuboCop::AST::WhileNode, RuboCop::AST::YieldNode, RuboCop::AST::NodePattern::Node, RuboCop::AST::NodePattern::Node::AnyOrder, RuboCop::AST::NodePattern::Node::Capture, RuboCop::AST::NodePattern::Node::Predicate, RuboCop::AST::NodePattern::Node::Repetition, RuboCop::AST::NodePattern::Node::Rest, RuboCop::AST::NodePattern::Node::Sequence, RuboCop::AST::NodePattern::Node::Subsequence, RuboCop::AST::NodePattern::Node::Union
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, AST::Node
Instance Chain:
self, AST::Node
Inherits: AST::Node
  • Object
Defined in: lib/rubocop/ast/vendor/parser/ast/node.rb

Overview

Node contains information about a single AST node and its child nodes. It extends the basic [AST::Node](https://www.rubydoc.info/gems/ast/AST/Node) class provided by gem [ast](https://www.rubydoc.info/gems/ast).

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#loc (readonly)

Alias for #location.

[ GitHub ]

  
# File 'lib/rubocop/ast/vendor/parser/ast/node.rb', line 20

alias loc location

#location ⇒ Parser::Source::Map (readonly) Also known as: #loc

Source map for this Node.

[ GitHub ]

  
# File 'lib/rubocop/ast/vendor/parser/ast/node.rb', line 17

class Node < ::AST::Node
  attr_reader :location

  alias loc location

  ##
  # Assigns various properties to this AST node. Currently only the
  # location can be set.
  #
  # @param [Hash] properties
  # @option properties [Parser::Source::Map] :location Location information
  #  of the node.
  #
  def assign_properties(properties)
    if (location = properties[:location])
      location = location.dup if location.frozen?
      location.node = self
      @location = location
    end
  end
end

Instance Method Details

#assign_properties(properties)

Assigns various properties to this AST node. Currently only the location can be set.

Parameters:

  • properties (Hash)

Options Hash (properties):

[ GitHub ]

  
# File 'lib/rubocop/ast/vendor/parser/ast/node.rb', line 30

def assign_properties(properties)
  if (location = properties[:location])
    location = location.dup if location.frozen?
    location.node = self
    @location = location
  end
end