Class: Onebox::Engine::AudioOnebox

Inherits:
Object
  • Object
show all
Includes:
Onebox::Engine
Defined in:
lib/onebox/engine/audio_onebox.rb

Constant Summary

Constants included from Onebox::Engine

DEFAULT

Instance Attribute Summary

Attributes included from Onebox::Engine

#timeout, #uri, #url

Instance Method Summary collapse

Methods included from Onebox::Engine

engines, included, #initialize, #options, #options=

Instance Method Details

#always_https?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/onebox/engine/audio_onebox.rb', line 10

def always_https?
  WhitelistedGenericOnebox.host_matches(uri, WhitelistedGenericOnebox.https_hosts)
end

#placeholder_htmlObject



25
26
27
# File 'lib/onebox/engine/audio_onebox.rb', line 25

def placeholder_html
  ::Onebox::Helpers.audio_placeholder_html
end

#to_htmlObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/onebox/engine/audio_onebox.rb', line 14

def to_html
  escaped_url = ::Onebox::Helpers.normalize_url_for_output(@url)

  <<-HTML
    <audio controls>
      <source src="#{escaped_url}">
      <a href="#{escaped_url}">#{@url}</a>
    </audio>
  HTML
end