class RuboCop::Cop::Style::ExpandPathArguments
def autocorrect_expand_path(corrector, current_path, default_dir)
def autocorrect_expand_path(corrector, current_path, default_dir) stripped_current_path = strip_surrounded_quotes!(current_path.source) case depth(stripped_current_path) when 0 range = arguments_range(current_path) corrector.replace(range, '__FILE__') when 1 range = arguments_range(current_path) corrector.replace(range, '__dir__') else new_path = "'#{parent_path(stripped_current_path)}'" corrector.replace(current_path.loc.expression, new_path) corrector.replace(default_dir.loc.expression, '__dir__') end end