Sha256: 71ebe2292f2a12a77f5cf6efec3c1939aab9f71e9e35c044ddc07a52b8cf7590
Contents?: true
Size: 516 Bytes
Versions: 17
Compression:
Stored size: 516 Bytes
Contents
class ContentVideoDecorator < ApplicationDecorator delegate_all def embed_url url.to_s.include?('vimeo') ? vimeo_embed_url : youtube_embed_url end def aspect_ratio_class aspect_ratio.to_s.split('x').join('by') end private def vimeo_embed_url video_id = /[0-9*]+/.match(url.to_s).to_s "https://player.vimeo.com/video/#{video_id}" end def youtube_embed_url video_id = url.to_s.split('v=').last.split('&').first "https://www.youtube.com/embed/#{video_id}?rel=0" end end
Version data entries
17 entries across 17 versions & 1 rubygems