Sha256: e8db6b1a1cf81bc73e2334d41c0ee004947e6b2f2c4efedfa416fac888dc3b38
Contents?: true
Size: 402 Bytes
Versions: 48
Compression:
Stored size: 402 Bytes
Contents
module Coco module Embeds class Youtube < Coco::Component component_name :youtube_embed 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 end
Version data entries
48 entries across 48 versions & 1 rubygems