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

Version Path
lalala-4.1.0.dev.305 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.299 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.291 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.288 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.285 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.284 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.283 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.279 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.277 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.275 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.269 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.267 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.264 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.260 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.258 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.256 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.255 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.254 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.249 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.246 lib/lalala/markdown/handlers/youtube.rb