Sha256: 56cfdb09e08d39da726e9fabc7f293985bc068111a8c8ca5e79ec81493378d3b

Contents?: true

Size: 466 Bytes

Versions: 3

Compression:

Stored size: 466 Bytes

Contents

module Onebox
  module Engine
    class YoutubeOnebox
      include Engine
      include StandardEmbed

      matches_regexp /^https?:\/\/(?:www\.)?(?:youtube\.com|youtu\.be)\/.+$/

      def to_html
        rewrite_agnostic(append_embed_wmode(raw[:html]))
      end

      def append_embed_wmode(html)
        html.gsub /(src="[^"]+)/, '\1&wmode=opaque'
      end

      def rewrite_agnostic(html)
        html.gsub(/https?:\/\//, '//')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
onebox-1.2.2 lib/onebox/engine/youtube_onebox.rb
onebox-1.2.1 lib/onebox/engine/youtube_onebox.rb
onebox-1.2.0 lib/onebox/engine/youtube_onebox.rb