Class: HamlLint::Tree::HamlCommentNode
- 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
- #directives ⇒ Object
-
#text ⇒ String
Returns the full text content of this comment, including newlines if a single comment spans multiple lines.
Methods inherited from Node
#comment_configuration, #disabled?, #each, #initialize, #inspect, #keyword, #line_numbers, #lines, #next_node, #predecessor, #source_code, #subsequents, #successor
Constructor Details
This class inherits a constructor from HamlLint::Tree::Node
Instance Method Details
#directives ⇒ Object
8 9 10 11 12 |
# File 'lib/haml_lint/tree/haml_comment_node.rb', line 8 def directives directives = super directives << contained_directives directives.flatten end |
#text ⇒ String
Returns the full text content of this comment, including newlines if a single comment spans multiple lines.
18 19 20 21 22 23 24 25 26 |
# File 'lib/haml_lint/tree/haml_comment_node.rb', line 18 def text content = source_code indent = content[/^ */] content.gsub(/^#{indent}/, '') .gsub(/^-#/, '') .gsub(/^ /, '') .rstrip end |