Class: BELParser::Parsers::AST::Unset

Inherits:
Node show all
Defined in:
lib/bel_parser/parsers/ast/node.rb

Overview

AST node representing an unset.

Instance Attribute Summary

Attributes inherited from Node

#character_range, #complete, #line_number

Attributes inherited from AST::Node

#children, #hash, #type

Instance Method Summary collapse

Methods inherited from Node

#add_syntax_error, #append, #child, #children?, #complete?, #concat, #first_child, #fourth_child, #freeze, #incomplete?, #num_children, #range_end, #range_start, #second_child, #syntax_errors, #third_child, #traverse, #updated

Methods inherited from AST::Node

#==, #append, #concat, #dup, #eql?, #inspect, #to_a, #to_ast, #to_bel, #to_s, #to_sexp, #updated

Methods included from BELParser::Parsers

#serialize

Constructor Details

#initialize(children = [], properties = {}) ⇒ Unset

New Unset AST node.



908
909
910
# File 'lib/bel_parser/parsers/ast/node.rb', line 908

def initialize(children = [], properties = {})
  super(Unset.ast_type, children, properties)
end

Instance Method Details

#nameString?

Get what is being unset.

Returns:

  • (String, nil)

    what is being unset



915
916
917
918
919
# File 'lib/bel_parser/parsers/ast/node.rb', line 915

def name
  return nil unless children?
  return nil unless first_child.children?
  first_child.first_child
end