class HamlLint::Tree::HamlCommentNode
Represents a HAML comment node.
Public Instance Methods
directives()
click to toggle source
Calls superclass method
# File lib/haml_lint/tree/haml_comment_node.rb, line 7 def directives directives = super directives << contained_directives directives.flatten end
text()
click to toggle source
Returns the full text content of this comment, including newlines if a single comment spans multiple lines.
@return [String]
# File lib/haml_lint/tree/haml_comment_node.rb, line 17 def text content = source_code indent = content[/^ */] content.gsub(/^#{indent}/, '') .gsub(/^-#/, '') .gsub(/^ /, '') .rstrip end
Private Instance Methods
contained_directives()
click to toggle source
# File lib/haml_lint/tree/haml_comment_node.rb, line 29 def contained_directives text .split("\n") .each_with_index .map { |source, offset| HamlLint::Directive.from_line(source, line + offset) } .reject { |directive| directive.is_a?(HamlLint::Directive::Null) } end