Class: ClosingComments::Source::Problem
- Inherits:
-
Object
- Object
- ClosingComments::Source::Problem
- Defined in:
- lib/closing_comments/source.rb
Instance Method Summary collapse
- #column ⇒ Object
- #fix ⇒ Object
-
#initialize(entity, line) ⇒ Problem
constructor
A new instance of Problem.
- #line ⇒ Object
- #message ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(entity, line) ⇒ Problem
Returns a new instance of Problem.
67 68 69 70 |
# File 'lib/closing_comments/source.rb', line 67 def initialize(entity, line) @entity = entity @line = line end |
Instance Method Details
#column ⇒ Object
76 77 78 |
# File 'lib/closing_comments/source.rb', line 76 def column @line.index('end') end |
#fix ⇒ Object
80 81 82 |
# File 'lib/closing_comments/source.rb', line 80 def fix @line[0...column] + @entity.ending end |
#line ⇒ Object
72 73 74 |
# File 'lib/closing_comments/source.rb', line 72 def line @entity.last_line end |
#message ⇒ Object
84 85 86 |
# File 'lib/closing_comments/source.rb', line 84 def "missing #{@entity.entity} closing comment" end |
#to_h ⇒ Object
88 89 90 91 92 93 94 |
# File 'lib/closing_comments/source.rb', line 88 def to_h { line: line, column: column, message: , } end |