class Gembed::Vimeo

Public Class Methods

embed(url, height: "100%", width: "100%") click to toggle source
# File lib/gembed/vimeo.rb, line 3
def self.embed(url, height: "100%", width: "100%")
  result = "<iframe src='https://player.vimeo.com/video/#{find_id(url)}?title=0&byline=0&portrait=0' frameborder='0' webkitallowfullscreen mozallowfullscreen allowfullscreen style='position: absolute; top: 0; left: 0; width: #{width}; height: #{height};'></iframe>"
  result.respond_to?(:html_safe) ? result.html_safe : result
end
find_id(url) click to toggle source
# File lib/gembed/vimeo.rb, line 8
def self.find_id(url)
  url.split("vimeo.com/")[1]
end