Class: Bootstrap4RailsComponents::Bootstrap::Components::Embed
- Inherits:
-
Base
- Object
- Base
- Bootstrap4RailsComponents::Bootstrap::Components::Embed
show all
- Defined in:
- lib/bootstrap4_rails_components/bootstrap/components/embed.rb
Overview
Instance Attribute Summary
Attributes inherited from Base
#body, #options, #view_context
Instance Method Summary
collapse
Methods inherited from Base
#component_family, #component_initialize, #data, #href, #html_options, #id, #initialize, #style, #utility_initialize
Instance Method Details
#aspect_ratio ⇒ Object
9
10
11
|
# File 'lib/bootstrap4_rails_components/bootstrap/components/embed.rb', line 9
def aspect_ratio
options.fetch(:aspect_ratio, default_aspect_ratio) || default_aspect_ratio
end
|
#autoplay ⇒ Object
22
23
24
|
# File 'lib/bootstrap4_rails_components/bootstrap/components/embed.rb', line 22
def autoplay
options.fetch(:autoplay, default_autoplay)
end
|
#iframe ⇒ Object
13
14
15
16
|
# File 'lib/bootstrap4_rails_components/bootstrap/components/embed.rb', line 13
def iframe
return unless iframe?
view_context.content_tag :iframe, nil, src: src, class: 'embed-responsive-item', allowfullscreen: true
end
|
#iframe? ⇒ Boolean
18
19
20
|
# File 'lib/bootstrap4_rails_components/bootstrap/components/embed.rb', line 18
def iframe?
options[:iframe].present?
end
|
#render ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'lib/bootstrap4_rails_components/bootstrap/components/embed.rb', line 26
def render
super do
if iframe?
iframe
else
(block_given? ? yield : body)
end
end
end
|