Class: HamlLint::CommentConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/haml_lint/comment_configuration.rb

Overview

Determines what linters are enabled or disabled via comments.

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ CommentConfiguration

Instantiates a new HamlLint::CommentConfiguration.

Parameters:



9
10
11
# File 'lib/haml_lint/comment_configuration.rb', line 9

def initialize(node)
  @directives = node.directives.reverse
end

Instance Method Details

#disabled?(linter_name) ⇒ true, false

Checks whether a linter is disabled for the node.

Parameters:

  • linter_name (String)

    the name of the linter

Returns:

  • (true, false)


18
19
20
21
22
# File 'lib/haml_lint/comment_configuration.rb', line 18

def disabled?(linter_name)
  most_recent_disabled = directives_for(linter_name).map(&:disable?).first

  most_recent_disabled || false
end