Sha256: a74173d5ed14b2caf4620342183538ab5afb4495f879bd9015932a8467703907

Contents?: true

Size: 642 Bytes

Versions: 11

Compression:

Stored size: 642 Bytes

Contents

module Onebox
  module Engine
    class GiphyOnebox
      include Engine
      include StandardEmbed

      matches_regexp(/^https?:\/\/(giphy\.com\/gifs|gph\.is)\//)
      always_https

      def to_html
        oembed = get_oembed
        escaped_url = ::Onebox::Helpers.normalize_url_for_output(oembed[:url])
        escaped_src = ::Onebox::Helpers.normalize_url_for_output(oembed[:image])

        <<-HTML
          <a href="#{escaped_url}" target="_blank">
            <img src="#{escaped_src}" width="#{oembed[:width]}" height="#{oembed[:height]}" #{Helpers.title_attr(oembed)}>
          </a>
        HTML
      end

    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
onebox-1.8.4 lib/onebox/engine/giphy_onebox.rb
onebox-1.8.3 lib/onebox/engine/giphy_onebox.rb
onebox-1.8.2 lib/onebox/engine/giphy_onebox.rb
onebox-1.8.1 lib/onebox/engine/giphy_onebox.rb
onebox-1.8.0 lib/onebox/engine/giphy_onebox.rb
onebox-1.7.9 lib/onebox/engine/giphy_onebox.rb
onebox-1.7.8 lib/onebox/engine/giphy_onebox.rb
onebox-1.7.7 lib/onebox/engine/giphy_onebox.rb
onebox-1.7.6 lib/onebox/engine/giphy_onebox.rb
onebox-1.7.5 lib/onebox/engine/giphy_onebox.rb
onebox-1.7.4 lib/onebox/engine/giphy_onebox.rb