Class: Builders::Default
- Inherits:
-
Object
- Object
- Builders::Default
- Defined in:
- lib/parser/builders/default.rb
Overview
Default AST builder. Uses Parser::AST::Nodes.
Instance Attribute Summary (collapse)
-
- (Boolean) emit_file_line_as_literals
If set to true,
__FILE__
and__LINE__
are transformed to literal nodes.
Instance Method Summary (collapse)
-
- (Default) initialize
constructor
Initializes attributes:.
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.
21 22 23 |
# File 'lib/parser/builders/default.rb', line 21 def emit_file_line_as_literals @emit_file_line_as_literals end |