Sha256: a1f792e91395ee1f853b51ccfbb2e56fd225ac44606e9a422d361a803d5f0d6f
Contents?: true
Size: 638 Bytes
Versions: 4
Compression:
Stored size: 638 Bytes
Contents
module Vapid module Directives # Audio directive class Audio < Vapid::Directive # Allow OEmbed from the following providers PROVIDERS = %w( SoundCloud ).freeze OEmbed::Providers.register(*PROVIDERS.map { |p| OEmbed::Providers.const_get(p) }) renders :html do |input| unless input.blank? begin OEmbed::Providers.get(input).html rescue OEmbed::NotFound content_tag(:a, input, href: input) end end end form preview: true do |name, value| text_field_tag name, value: value end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
vapid-0.1.3 | lib/vapid/directives/audio.rb |
vapid-0.1.2 | lib/vapid/directives/audio.rb |
vapid-0.1.1 | lib/vapid/directives/audio.rb |
vapid-0.1.0 | lib/vapid/directives/audio.rb |