Class: LibRubyParser::Nodes::XHeredoc
- Inherits:
-
LibRubyParser::Node
- Object
- LibRubyParser::Node
- LibRubyParser::Nodes::XHeredoc
- Defined in:
- lib/lib-ruby-parser/nodes.rb
Overview
Represents a executable here-document literal (both with and without interpolation)
It's similar to Xstr
in terms of abstract syntax tree, but has different source maps.
Instance Attribute Summary collapse
-
#expression_l ⇒ Loc
readonly
Location of the executable here-document identifier.
-
#heredoc_body_l ⇒ Loc
readonly
Location of the executable here-document body.
-
#heredoc_end_l ⇒ Loc
readonly
Location of the executable here-document end.
-
#parts ⇒ ::Array<Node>
readonly
A list of string parts (static literals and interpolated expressions).
Instance Attribute Details
#expression_l ⇒ Loc (readonly)
Location of the executable here-document identifier
<<-`HERE`\n a\n #{42}\nHERE
~~~~~~~
Note: This is the only node (with Heredoc
) that has expression_l
smaller that all other sub-locations merged.
The reason for that is that it's possible to add more code after here-document ID:
<<-`HERE` + "rest"
content
HERE
4341 4342 4343 |
# File 'lib/lib-ruby-parser/nodes.rb', line 4341 def expression_l @expression_l end |
#heredoc_body_l ⇒ Loc (readonly)
Location of the executable here-document body
<<-`HERE`\n a\n #{42}\nHERE
~~~~~~~~~~~~~~~
4314 4315 4316 |
# File 'lib/lib-ruby-parser/nodes.rb', line 4314 def heredoc_body_l @heredoc_body_l end |
#heredoc_end_l ⇒ Loc (readonly)
Location of the executable here-document end
<<-`HERE`\n a\n #{42}\nHERE
~~~~
4323 4324 4325 |
# File 'lib/lib-ruby-parser/nodes.rb', line 4323 def heredoc_end_l @heredoc_end_l end |
#parts ⇒ ::Array<Node> (readonly)
A list of string parts (static literals and interpolated expressions)
4305 4306 4307 |
# File 'lib/lib-ruby-parser/nodes.rb', line 4305 def parts @parts end |