Use &.methods where possible instead of curly braces

このコミットが含まれているのは:
matthewmcgarvey 2022-01-17 13:03:36 -06:00
コミット 9233f71549
1個のファイルの変更1行の追加1行の削除

ファイルの表示

@ -276,7 +276,7 @@ def fetch_reddit_comments(id, sort_by = "confidence")
# For videos that have more than one thread, choose the one with the highest score
threads = search_results.data.as(RedditListing).children
thread = threads.max_by? { |child| child.data.as(RedditLink).score }.try(&.data.as(RedditLink))
thread = threads.max_by?(&.data.as(RedditLink).score).try(&.data.as(RedditLink))
result = thread.try do |t|
body = client.get("/r/#{t.subreddit}/comments/#{t.id}.json?limit=100&sort=#{sort_by}", headers).body
Array(RedditThing).from_json(body)