151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
# File 'lib/rubocop/cop/layout/empty_line_between_defs.rb', line 151
def autocorrect(corrector, prev_def, node, count)
end_pos = end_loc(prev_def).end_pos
source_buffer = end_loc(prev_def).source_buffer
newline_pos = source_buffer.source.index("\n", end_pos)
begin_pos = node.source_range.begin_pos
newline_pos = begin_pos - 1 if newline_pos > begin_pos
if count > maximum_empty_lines
autocorrect_remove_lines(corrector, newline_pos, count)
else
autocorrect_insert_lines(corrector, newline_pos, count)
end
end
|