Class: HamlLint::Tree::HamlCommentNode

Inherits:
Node
  • Object
show all
Defined in:
lib/haml_lint/tree/haml_comment_node.rb

Overview

Represents a HAML comment node.

Instance Attribute Summary

Attributes inherited from Node

#children, #line, #parent, #type

Instance Method Summary collapse

Methods inherited from Node

#find, #initialize, #inspect, #next_node, #source_code, #successor

Constructor Details

This class inherits a constructor from HamlLint::Tree::Node

Instance Method Details

#textString

Returns the full text content of this comment, including newlines if a single comment spans multiple lines.

Returns:

  • (String)


8
9
10
11
12
13
14
15
16
# File 'lib/haml_lint/tree/haml_comment_node.rb', line 8

def text
  content = source_code
  indent = content[/^ */]

  content.gsub(/^#{indent}/, '')
         .gsub(/^-#/, '')
         .gsub(/^  /, '')
         .rstrip
end