File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -44,10 +44,10 @@ def convert_shownote(content)
4444 HTML
4545 content . gsub! ( /(#+) Shownote/ ) { shownote }
4646
47- return content unless content . match? ( Podcast ::YOUTUBE_ID_REGEX )
48- return content unless content . match? ( Podcast ::TIMESTAMP_REGEX )
49- youtube_id = @episode . content . match ( Podcast ::YOUTUBE_ID_REGEX ) [ 1 ]
50- content . gsub! ( Podcast ::TIMESTAMP_REGEX ) do
47+ return content unless content . match? ( Podcast ::REGEX_YOUTUBE_ID )
48+ return content unless content . match? ( Podcast ::REGEX_TIMESTAMP )
49+ youtube_id = @episode . content . match ( Podcast ::REGEX_YOUTUBE_ID ) [ 1 ]
50+ content . gsub! ( Podcast ::REGEX_TIMESTAMP ) do
5151 original_t = $1
5252 parts = original_t . split ( ':' )
5353
Original file line number Diff line number Diff line change @@ -3,8 +3,8 @@ class Podcast < ApplicationRecord
33 DIR_PATH = 'public/podcasts'
44 WDAY2JAPANESE = %w( 日 月 火 水 木 金 土 )
55 # Match timestamps at the beginning of lines (YouTube format)
6- TIMESTAMP_REGEX = /^((\d {1,2}:)?\d {1,2}:\d {2})/
7- YOUTUBE_ID_REGEX = /watch\? v=((\w )*)/
6+ REGEX_TIMESTAMP = /^((\d {1,2}:)?\d {1,2}:\d {2})/
7+ REGEX_YOUTUBE_ID = /watch\? v=((\w )*)/
88
99 validates :title , presence : true
1010 validates :content_size , presence : true
You can’t perform that action at this time.
0 commit comments