Class: AdLint::MessageSuppressorSet

Inherits:
Object
  • Object
show all
Defined in:
lib/adlint/supp.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initializeMessageSuppressorSet

Returns a new instance of MessageSuppressorSet.



35
36
37
38
# File 'lib/adlint/supp.rb', line 35

def initialize
  @file_wise_suppressions = {}
  @line_wise_suppressions = {}
end

Instance Method Details

#add(supp) ⇒ Object



40
41
42
43
44
45
46
47
# File 'lib/adlint/supp.rb', line 40

def add(supp)
  case
  when supp.file_wise?
    @file_wise_suppressions[supp.key] = supp
  when supp.line_wise?
    @line_wise_suppressions[supp.key] = supp
  end
end

#suppress?(msg) ⇒ Boolean

Returns:

  • (Boolean)


49
50
51
52
53
54
55
# File 'lib/adlint/supp.rb', line 49

def suppress?(msg)
  (supp = @file_wise_suppressions[file_wise_key_of(msg)]) &&
    supp.suppress?(msg) or
  (supp = @line_wise_suppressions[line_wise_key_of(msg)]) &&
    supp.suppress?(msg) or
  false
end