class Videos::YouTube

Public Instance Methods

embed_code() click to toggle source
# File lib/videos/youtube.rb, line 2
def embed_code
  content_tag(:iframe, '', type: 'text/html', width: width, height: height, src: src)
end
Also aliased as: to_html
id() click to toggle source
# File lib/videos/youtube.rb, line 7
def id
  id = ''
  url = @uri.to_s.gsub(/(>|<)/i,'').split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/)
  if url[2] != nil
    id = url[2].split(/[^0-9a-z_\-]/i)
    id = id[0];
  else
    id = url;
  end
  id
end
src() click to toggle source
# File lib/videos/youtube.rb, line 19
def src
  "https://www.youtube.com/embed/#{id}"
end
to_html()
Alias for: embed_code