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:



7
8
9
# File 'lib/haml_lint/comment_configuration.rb', line 7

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)


16
17
18
19
20
# File 'lib/haml_lint/comment_configuration.rb', line 16

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

  most_recent_disabled || false
end