123456789_123456789_123456789_123456789_123456789_

Module: RuboCop::AST::BuilderExtensions Private

Do not use. This module is for internal use only.
Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/rubocop/ast/builder.rb

Overview

Common functionality between the parser and prism builder

Constant Summary

Class Method Summary

Instance Method Summary

Class Method Details

.included(base)

[ GitHub ]

  
# File 'lib/rubocop/ast/builder.rb', line 8

def self.included(base)
  base.emit_forward_arg = true
  base.emit_match_pattern = true
end

Instance Method Details

#n(type, children, source_map) ⇒ Node

Generates Node from the given information.

Returns:

  • (Node)

    the generated node

[ GitHub ]

  
# File 'lib/rubocop/ast/builder.rb', line 100

def n(type, children, source_map)
  node_klass(type).new(type, children, location: source_map)
end

#node_klass(type) (private)

[ GitHub ]

  
# File 'lib/rubocop/ast/builder.rb', line 112

def node_klass(type)
  NODE_MAP[type] || Node
end

#string_value(token)

Overwrite the base method to allow strings with invalid encoding More details here https://github.com/whitequark/parser/issues/283

[ GitHub ]

  
# File 'lib/rubocop/ast/builder.rb', line 106

def string_value(token)
  value(token)
end