File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -27,18 +27,18 @@ namespace :news do
2727 feed . items . map { |item |
2828 # RSS 1.0 (RDF) と RSS 2.0 の両方に対応
2929 # RSS 2.0: pubDate, RSS 1.0 (RDF): dc:date
30- published_at = if item . respond_to? ( :pubDate )
31- item . pubDate . to_s
32- elsif item . respond_to? ( :dc_date )
33- item . dc_date . to_s
30+ published_at = if item . respond_to? ( :pubDate ) && item . pubDate
31+ item . pubDate
32+ elsif item . respond_to? ( :dc_date ) && item . dc_date
33+ item . dc_date
3434 else
35- Time . current . to_s
35+ raise "Unexpected RSS format: neither pubDate nor dc:date found for item: #{ item . link } "
3636 end
3737
3838 {
3939 'url' => item . link ,
4040 'title' => item . title ,
41- 'published_at' => published_at
41+ 'published_at' => published_at . iso8601 # ISO 8601 形式に統一
4242 }
4343 }
4444 end
You can’t perform that action at this time.
0 commit comments