Class: FoodCritic::Warning

Inherits:
Object
  • Object
show all
Defined in:
lib/foodcritic/domain.rb

Overview

A warning of a possible issue

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rule, match = {}, options = {}) ⇒ Warning

Create a new warning.

Warning.new(rule, :filename => 'foo/recipes.default.rb',
  :line => 5, :column=> 40)


13
14
15
16
17
18
19
20
# File 'lib/foodcritic/domain.rb', line 13

def initialize(rule, match = {}, options = {})
  @rule, @match = rule, match
  @is_failed = if options[:fail_tags].empty?
                 false
               else
                 rule.matches_tags?(options[:fail_tags])
               end
end

Instance Attribute Details

#is_failedObject (readonly)

Returns the value of attribute is_failed.



6
7
8
# File 'lib/foodcritic/domain.rb', line 6

def is_failed
  @is_failed
end

#matchObject (readonly)

Returns the value of attribute match.



6
7
8
# File 'lib/foodcritic/domain.rb', line 6

def match
  @match
end

#ruleObject (readonly)

Returns the value of attribute rule.



6
7
8
# File 'lib/foodcritic/domain.rb', line 6

def rule
  @rule
end

Instance Method Details

#failed?Boolean

If this warning has failed or not.

Returns:

  • (Boolean)


23
24
25
# File 'lib/foodcritic/domain.rb', line 23

def failed?
  @is_failed
end