Module: SeeingIsBelieving::RemoveInlineComments::NonLeading
- Defined in:
- lib/seeing_is_believing/remove_inline_comments.rb
Class Method Summary collapse
Class Method Details
.call(code) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/seeing_is_believing/remove_inline_comments.rb', line 6 def self.call(code) ranges = [] nonleading_comments = lambda do |buffer, rewriter| ranges.sort_by(&:begin_pos) .drop_while.with_index(1) { |range, index| line, col = buffer.decompose_position range.begin_pos index == line && col.zero? } .each { |range| rewriter.remove range } end RemoveInlineComments.call code, additional_rewrites: nonleading_comments do |comment| ranges << comment.location.expression false end end |