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.0.0.dev.388 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.385 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.382 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.381 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.376 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.375 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.374 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.372 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.368 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.367 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.366 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.360 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.359 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.358 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.357 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.356 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.355 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.354 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.351 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.350 lib/lalala/markdown/handlers/youtube.rb