Class: CodeAnalyzer::Warning
- Inherits:
-
Object
- Object
- CodeAnalyzer::Warning
- Defined in:
- lib/code_analyzer/warning.rb
Overview
Warning is the violation.
it indicates the filenname, line number and error message for the violation.
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#line_number ⇒ Object
readonly
Returns the value of attribute line_number.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Warning
constructor
A new instance of Warning.
- #to_s ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Warning
Returns a new instance of Warning.
10 11 12 13 14 |
# File 'lib/code_analyzer/warning.rb', line 10 def initialize( = {}) @filename = [:filename] @line_number = [:line_number].to_s @message = [:message] end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
8 9 10 |
# File 'lib/code_analyzer/warning.rb', line 8 def filename @filename end |
#line_number ⇒ Object (readonly)
Returns the value of attribute line_number.
8 9 10 |
# File 'lib/code_analyzer/warning.rb', line 8 def line_number @line_number end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
8 9 10 |
# File 'lib/code_analyzer/warning.rb', line 8 def @message end |
Instance Method Details
#to_s ⇒ Object
16 17 18 |
# File 'lib/code_analyzer/warning.rb', line 16 def to_s "#{@filename}:#{@line_number} - #{@message}" end |