Class: Blacklight::Oembed::DocumentOembedComponent

Inherits:
Component
  • Object
show all
Defined in:
app/components/blacklight/oembed/document_oembed_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(document:, presenter:, classes: ['oembed-widget'], **kwargs) ⇒ DocumentOembedComponent

Returns a new instance of DocumentOembedComponent.



6
7
8
9
10
11
12
# File 'app/components/blacklight/oembed/document_oembed_component.rb', line 6

def initialize(document:, presenter:, classes: ['oembed-widget'], **kwargs)
  super

  @document = document
  @presenter = presenter
  @classes = classes
end

Instance Attribute Details

#classesObject (readonly)

Returns the value of attribute classes.



4
5
6
# File 'app/components/blacklight/oembed/document_oembed_component.rb', line 4

def classes
  @classes
end

#documentObject (readonly)

Returns the value of attribute document.



4
5
6
# File 'app/components/blacklight/oembed/document_oembed_component.rb', line 4

def document
  @document
end

#presenterObject (readonly)

Returns the value of attribute presenter.



4
5
6
# File 'app/components/blacklight/oembed/document_oembed_component.rb', line 4

def presenter
  @presenter
end

Instance Method Details

#embedObject



14
15
16
17
18
19
20
21
22
23
24
# File 'app/components/blacklight/oembed/document_oembed_component.rb', line 14

def embed
  return if embed_url.blank?

  @embed ||= if Blacklight::Oembed::Engine.config.render_helper != :render_oembed_tag_async && Blacklight::Oembed::Engine.config.render_helper != :render_oembed_tag_embed
               legacy_helper_method_embed_markup
             elsif view_config.render_oembed_using_async_javascript || Blacklight::Oembed::Engine.config.render_helper == :render_oembed_tag_async
               async_embed_markup
             else
               inline_embed_markup
             end
end

#render?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'app/components/blacklight/oembed/document_oembed_component.rb', line 26

def render?
  embed.present?
end