Class: LibRubyParser::Nodes::Heredoc

Inherits:
LibRubyParser::Node show all
Defined in:
lib/lib-ruby-parser/nodes.rb

Overview

Represents a here-document literal (both with and without interpolation)

It's similar to Dstr in terms of abstract syntax tree, but has different source maps.

Instance Attribute Summary collapse

Instance Attribute Details

#expression_lLoc (readonly)

Location of the here-document identifier

<<-HERE\n  a\n   #{42}\nHERE
~~~~~~~

Note: This is the only node (with XHeredoc) 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

Returns:



1779
1780
1781
# File 'lib/lib-ruby-parser/nodes.rb', line 1779

def expression_l
  @expression_l
end

#heredoc_body_lLoc (readonly)

Location of the here-document body

<<-HERE\n  a\n   #{42}\nHERE
~~~~~~~~~~~~~~~

Returns:



1752
1753
1754
# File 'lib/lib-ruby-parser/nodes.rb', line 1752

def heredoc_body_l
  @heredoc_body_l
end

#heredoc_end_lLoc (readonly)

Location of the here-document end

<<-HERE\n  a\n   #{42}\nHERE
                        ~~~~

Returns:



1761
1762
1763
# File 'lib/lib-ruby-parser/nodes.rb', line 1761

def heredoc_end_l
  @heredoc_end_l
end

#parts::Array<Node> (readonly)

A list of string parts (static literals and interpolated expressions)

Returns:



1743
1744
1745
# File 'lib/lib-ruby-parser/nodes.rb', line 1743

def parts
  @parts
end