Skip to content

Commit cddb4ab

Browse files
committed
style: コメントとYAML書き出しのインデント整理
- 「既存データをハッシュに変換」コメントのインデントを修正 - File.open内のformatted_items生成部分のインデントを整理
1 parent 5f1b8bd commit cddb4ab

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lib/tasks/fetch_news.rake

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ namespace :news do
6464
end
6565
end
6666

67-
# 既存データをハッシュに変換(URL をキーに)
67+
# 既存データをハッシュに変換(URL をキーに)
6868
existing_items_hash = existing_news.index_by { |item| item['url'] }
6969

7070
# 新しいアイテムと既存アイテムを分離
@@ -108,17 +108,17 @@ namespace :news do
108108
}.reverse
109109

110110
File.open('db/news.yml', 'w') do |f|
111-
formatted_items = sorted_items.map do |item|
112-
{
113-
'id' => item['id'],
114-
'url' => item['url'],
115-
'title' => item['title'],
116-
'published_at' => item['published_at']
117-
}
118-
end
119-
120-
f.write({ 'news' => formatted_items }.to_yaml)
121-
end
111+
formatted_items = sorted_items.map do |item|
112+
{
113+
'id' => item['id'],
114+
'url' => item['url'],
115+
'title' => item['title'],
116+
'published_at' => item['published_at']
117+
}
118+
end
119+
120+
f.write({ 'news' => formatted_items }.to_yaml)
121+
end
122122

123123
logger.info("✅ Wrote #{sorted_items.size} items to db/news.yml (#{truly_new_items_sorted.size} new, #{updated_items.size} updated)")
124124
logger.info('==== END news:fetch ====')

0 commit comments

Comments
 (0)