Class: Spektr::Warning
- Inherits:
-
Object
- Object
- Spektr::Warning
- Defined in:
- lib/spektr/warning.rb
Instance Attribute Summary collapse
-
#check ⇒ Object
Returns the value of attribute check.
-
#confidence ⇒ Object
Returns the value of attribute confidence.
-
#full_path ⇒ Object
Returns the value of attribute full_path.
-
#line ⇒ Object
Returns the value of attribute line.
-
#location ⇒ Object
Returns the value of attribute location.
-
#message ⇒ Object
Returns the value of attribute message.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #fingerprint ⇒ Object
- #full_message ⇒ Object
-
#initialize(path, full_path, check, location, message, confidence = :high) ⇒ Warning
constructor
A new instance of Warning.
Constructor Details
#initialize(path, full_path, check, location, message, confidence = :high) ⇒ Warning
Returns a new instance of Warning.
7 8 9 10 11 12 13 14 |
# File 'lib/spektr/warning.rb', line 7 def initialize(path, full_path, check, location, , confidence = :high) @path = path @check = check @location = location @message = @confidence = confidence @line = IO.readlines(full_path)[@location.line - 1].strip if full_path && @location && File.exist?(full_path) end |
Instance Attribute Details
#check ⇒ Object
Returns the value of attribute check.
5 6 7 |
# File 'lib/spektr/warning.rb', line 5 def check @check end |
#confidence ⇒ Object
Returns the value of attribute confidence.
5 6 7 |
# File 'lib/spektr/warning.rb', line 5 def confidence @confidence end |
#full_path ⇒ Object
Returns the value of attribute full_path.
5 6 7 |
# File 'lib/spektr/warning.rb', line 5 def full_path @full_path end |
#line ⇒ Object
Returns the value of attribute line.
5 6 7 |
# File 'lib/spektr/warning.rb', line 5 def line @line end |
#location ⇒ Object
Returns the value of attribute location.
5 6 7 |
# File 'lib/spektr/warning.rb', line 5 def location @location end |
#message ⇒ Object
Returns the value of attribute message.
5 6 7 |
# File 'lib/spektr/warning.rb', line 5 def @message end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/spektr/warning.rb', line 5 def path @path end |
Instance Method Details
#fingerprint ⇒ Object
24 25 26 |
# File 'lib/spektr/warning.rb', line 24 def fingerprint Digest::MD5.hexdigest("#{path}:#{line}:#{check.name}") end |
#full_message ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/spektr/warning.rb', line 16 def if @location "#{} at line #{@location.line} of #{@path}" else "#{}" end end |