Class: LibRubyParser::Nodes::XHeredoc

Inherits:
LibRubyParser::Node show all
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

Instance Attribute Details

#expression_lLoc (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

Returns:



4341
4342
4343
# File 'lib/lib-ruby-parser/nodes.rb', line 4341

def expression_l
  @expression_l
end

#heredoc_body_lLoc (readonly)

Location of the executable here-document body

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

Returns:



4314
4315
4316
# File 'lib/lib-ruby-parser/nodes.rb', line 4314

def heredoc_body_l
  @heredoc_body_l
end

#heredoc_end_lLoc (readonly)

Location of the executable here-document end

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

Returns:



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)

Returns:



4305
4306
4307
# File 'lib/lib-ruby-parser/nodes.rb', line 4305

def parts
  @parts
end