module RuboCop::Cop::Util
def source_range(source_buffer, line_number, column, length = 1)
def source_range(source_buffer, line_number, column, length = 1) if column.is_a?(Range) column_index = column.begin length = numeric_range_size(column) else column_index = column end line_begin_pos = if line_number == 0 0 else source_buffer.line_range(line_number).begin_pos end begin_pos = line_begin_pos + column_index end_pos = begin_pos + length Parser::Source::Range.new(source_buffer, begin_pos, end_pos) end