Sha256: e55eca6215472a88971beb897e238845ad1c924c953b190921953d920bccb5c0
Contents?: true
Size: 596 Bytes
Versions: 7
Compression:
Stored size: 596 Bytes
Contents
class Videos::Vimeo < Videos::Video VIMEO_DEFAULTS = { allowfullscreen: true } def initialize(uri,options={}) options = VIMEO_DEFAULTS.merge(options) super(uri,options) end def embed_code content_tag(:iframe, '', src: src, width: width, height: height, allowfullscreen: allowfullscreen) end alias_method :to_html, :embed_code def allowfullscreen @options[:allowfullscreen] end def src "https://player.vimeo.com/video/#{id}" end def id @uri.to_s.match(/https?:\/\/(?:[\w]+\.)*vimeo\.com(?:[\/\w]*\/?)?\/(?<id>[0-9]+)[^\s]*/)[:id] end end
Version data entries
7 entries across 7 versions & 1 rubygems