class RuboCop::Cop::Performance::IoReadlines
def autocorrect(corrector, enumerable_call, readlines_call, receiver)
def autocorrect(corrector, enumerable_call, readlines_call, receiver) # We cannot safely correct `.readlines` method called on IO/File classes # due to its signature and we are not sure with implicit receiver # if it is called in the context of some instance or mentioned class. return if receiver.nil? range = correction_range(enumerable_call, readlines_call) if readlines_call.arguments? call_args = build_call_args(readlines_call.arguments) replacement = "each_line(#{call_args})" else replacement = 'each_line' end corrector.replace(range, replacement) end