def find_scope_calls
scope_calls = []
if version_between?("2.1.0", "3.0.9")
ar_scope_calls(:named_scope) do |name, args|
call = make_call(nil, :named_scope, args).line(args.line)
scope_calls << scope_call_hash(call, name, :named_scope)
end
elsif version_between?("3.1.0", "9.9.9")
ar_scope_calls(:scope) do |name, args|
second_arg = args[2]
next unless sexp? second_arg
if second_arg.node_type == :iter and node_type? second_arg.block, :block, :call, :safe_call
process_scope_with_block(name, args)
elsif call? second_arg
call = second_arg
scope_calls << scope_call_hash(call, name, call.method)
else
call = make_call(nil, :scope, args).line(args.line)
scope_calls << scope_call_hash(call, name, :scope)
end
end
end
scope_calls
end