Class: Builders::Default

Inherits:
Object
  • Object
show all
Defined in:
lib/parser/builders/default.rb

Overview

Default AST builder. Uses Parser::AST::Nodes.

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Default) initialize

Initializes attributes:

  • emit_file_line_as_literals: true


27
28
29
# File 'lib/parser/builders/default.rb', line 27

def initialize
  @emit_file_line_as_literals = true
end

Instance Attribute Details

- (Boolean) emit_file_line_as_literals

If set to true, __FILE__ and __LINE__ are transformed to literal nodes. For example, s(:str, "lib/foo.rb") and s(:int, 10).

If set to false, __FILE__ and __LINE__ are emitted as-is, i.e. as s(:__FILE__) and s(:__LINE__) nodes.

Source maps are identical in both cases.

Returns:

  • (Boolean)


21
22
23
# File 'lib/parser/builders/default.rb', line 21

def emit_file_line_as_literals
  @emit_file_line_as_literals
end