Sha256: 0035f4d178cc8544fb97f03f19e424879fc6f409bcd329fecbbb3400620a7bf4

Contents?: true

Size: 853 Bytes

Versions: 30

Compression:

Stored size: 853 Bytes

Contents

# encoding: utf-8
module Prismic
  module Fragments
    class Embed < Fragment
      attr_accessor :embed_type, :provider, :url, :html, :o_embed_json

      def initialize(embed_type, provider, url, html, o_embed_json)
        @embed_type   = embed_type
        @provider     = provider
        @url          = url
        @html         = html
        @o_embed_json = o_embed_json
      end

      # Generate an HTML representation of the fragment
      #
      # @param link_resolver [LinkResolver] The LinkResolver used to build
      #     application's specific URL
      #
      # @return [String] the HTML representation
      def as_html(link_resolver=nil, html_serializer=nil)
        %Q|<div data-oembed="#{@url}" data-oembed-type="#{@embed_type.downcase}" data-oembed-provider="#{@provider.downcase}">#@html</div>|
      end
    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
prismic.io-1.8.2 lib/prismic/fragments/embed.rb
prismic.io-1.8.1 lib/prismic/fragments/embed.rb
prismic.io-1.8.0 lib/prismic/fragments/embed.rb
prismic.io-1.7.0 lib/prismic/fragments/embed.rb
prismic.io-1.6.1 lib/prismic/fragments/embed.rb
prismic.io-1.6.0 lib/prismic/fragments/embed.rb
prismic.io-1.5.0 lib/prismic/fragments/embed.rb
prismic.io-1.4.5 lib/prismic/fragments/embed.rb
prismic.io-1.4.4 lib/prismic/fragments/embed.rb
prismic.io-1.4.3 lib/prismic/fragments/embed.rb
prismic.io-1.4.2 lib/prismic/fragments/embed.rb
prismic.io-1.4.1 lib/prismic/fragments/embed.rb
prismic.io-1.4.0 lib/prismic/fragments/embed.rb
prismic.io-1.3.5 lib/prismic/fragments/embed.rb
prismic.io-1.3.4 lib/prismic/fragments/embed.rb
prismic.io-1.3.3 lib/prismic/fragments/embed.rb
prismic.io-1.3.2 lib/prismic/fragments/embed.rb
prismic.io-1.3.1 lib/prismic/fragments/embed.rb
prismic.io-1.3.0 lib/prismic/fragments/embed.rb
prismic.io-1.2.1 lib/prismic/fragments/embed.rb