Sha256: ba7c913514adb637e2560f468d1238248f8a97c0e8429412cb950ab563286be1
Contents?: true
Size: 589 Bytes
Versions: 10
Compression:
Stored size: 589 Bytes
Contents
# frozen_string_literal: true module Onebox module Engine class AudioOnebox include Engine matches_regexp(/^(https?:)?\/\/.*\.(mp3|ogg|opus|wav|m4a)(\?.*)?$/i) def always_https? WhitelistedGenericOnebox.host_matches(uri, WhitelistedGenericOnebox.https_hosts) end 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 end end end
Version data entries
10 entries across 10 versions & 1 rubygems