Sha256: 23892d6d597c93d9b7e98120c9c993bf1c9f9cc7bf60b3e90cfbc5bfc12b3702
Contents?: true
Size: 324 Bytes
Versions: 25
Compression:
Stored size: 324 Bytes
Contents
module Coco class YoutubeEmbed < Coco::Component def initialize(url:, **kwargs) @url = url end def video_id youtube_url = /youtube.com\/(watch\?v=|v\/)([^&]+)/.match(@url) youtube_url[2] if youtube_url end def src "https://www.youtube.com/embed/#{video_id}" end end end
Version data entries
25 entries across 25 versions & 1 rubygems