Skip to content

Commit 11a02cb

Browse files
committed
Remove not-necessary instance variables 'youtube' in Podcasts controller
1 parent 0de2189 commit 11a02cb

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

app/controllers/podcasts_controller.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ def show
2424
return redirect_to podcasts_path
2525
end
2626

27-
@youtube = @episode.content.match(/watch\?v=((\w)*)/)[1]
2827
@url = request.url
2928
@title = @episode.title.split('-').last.strip
3029
@date = @episode.published_date.strftime("%Y年%-m月%-d日(#{Podcast::WDAY2JAPANESE[@episode.published_date.wday]})")
@@ -36,6 +35,8 @@ def show
3635
private
3736

3837
def convert_shownote(content)
38+
youtube_id = @episode.content.match(/watch\?v=((\w)*)/)[1]
39+
3940
shownote = <<~HTML
4041
<h2 id='shownote'>
4142
<a href='#shownote'>🎤</a>
@@ -52,7 +53,7 @@ def convert_shownote(content)
5253
t = (t.size == '0:00'.size) ? '0' + t : t
5354
t = (t.size == '00:00'.size) ? '00:' + t : t
5455
t = Time.parse(t).seconds_since_midnight.to_i
55-
"- [#{$1}](https://youtu.be/#{@youtube}?t=#{t}) &nbsp; "
56+
"- [#{$1}](https://youtu.be/#{youtube_id}?t=#{t}) &nbsp; "
5657
end
5758
end
5859
end

0 commit comments

Comments
 (0)