Sha256: 56b6944ce1634a8a32995fd9904d8d977ecfd338ee721140c563bc97ef589b32

Contents?: true

Size: 746 Bytes

Versions: 16

Compression:

Stored size: 746 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 :span, class: "embed-container is-youtube" do
      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

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
lalala-4.1.0.dev.415 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.414 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.413 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.412 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.411 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.410 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.409 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.407 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.408 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.398 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.397 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.396 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.395 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.394 lib/lalala/markdown/handlers/youtube.rb
lalala-4.1.0.dev.392 lib/lalala/markdown/handlers/youtube.rb
lalala-4.0.0.dev.393 lib/lalala/markdown/handlers/youtube.rb