Sha256: 8c0737eff1e9a15bf050530273a8e1a504dcf1441ac1e6cee371fe1bfc9a8b82
Contents?: true
Size: 648 Bytes
Versions: 159
Compression:
Stored size: 648 Bytes
Contents
class Lalala::Markdown::Handlers::YouTube < Lalala::Markdown::Handlers::Base def initialize(options={}) options.assert_valid_keys(:width, :height) options = { width: 560, height: 315 }.merge(options) @options = options end def image(url, alt=nil, title=nil) unless %r|^youtube[:]//(.+)$| === url return "" end id = $1 helpers.content_tag( :iframe, "", width: @options[:width], height: @options[:height], src: "http://www.youtube.com/embed/#{id}?rel=0", frameborder: 0, allowfullscreen: true ) end end
Version data entries
159 entries across 159 versions & 1 rubygems