Class: RDocRuboCop::Lang::C::Corrector
- Inherits:
-
Object
- Object
- RDocRuboCop::Lang::C::Corrector
- Defined in:
- lib/rdoc_rubocop/lang/c/corrector.rb
Instance Attribute Summary collapse
-
#corrected_source ⇒ Object
readonly
Returns the value of attribute corrected_source.
Instance Method Summary collapse
- #correct ⇒ Object
-
#initialize(source_file) ⇒ Corrector
constructor
A new instance of Corrector.
Constructor Details
#initialize(source_file) ⇒ Corrector
Returns a new instance of Corrector.
7 8 9 10 |
# File 'lib/rdoc_rubocop/lang/c/corrector.rb', line 7 def initialize(source_file) @source_file = source_file @corrected_source = nil end |
Instance Attribute Details
#corrected_source ⇒ Object (readonly)
Returns the value of attribute corrected_source.
5 6 7 |
# File 'lib/rdoc_rubocop/lang/c/corrector.rb', line 5 def corrected_source @corrected_source end |
Instance Method Details
#correct ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rdoc_rubocop/lang/c/corrector.rb', line 12 def correct @corrected_source = @source_file.source.dup @source_file.comments.reverse_each do |comment| next if comment.source_codes.empty? index = comment.offset_begin length = comment.length @corrected_source[index, length] = comment.corrected_text end end |