File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ namespace :news do
64
64
end
65
65
end
66
66
67
- # 既存データをハッシュに変換(URL をキーに)
67
+ # 既存データをハッシュに変換(URL をキーに)
68
68
existing_items_hash = existing_news . index_by { |item | item [ 'url' ] }
69
69
70
70
# 新しいアイテムと既存アイテムを分離
@@ -108,17 +108,17 @@ namespace :news do
108
108
} . reverse
109
109
110
110
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
122
122
123
123
logger . info ( "✅ Wrote #{ sorted_items . size } items to db/news.yml (#{ truly_new_items_sorted . size } new, #{ updated_items . size } updated)" )
124
124
logger . info ( '==== END news:fetch ====' )
You can’t perform that action at this time.
0 commit comments