Sha256: 973d819b77f250fe6a1ad006149e906929d33b7c249977ffd17b3757242a41ae
Contents?: true
Size: 661 Bytes
Versions: 2
Compression:
Stored size: 661 Bytes
Contents
path_to_providers = File.join(File.dirname(__FILE__), "oembed_providers") Dir.entries(path_to_providers).each do |file| require "film_snob/oembed_providers/#{file}" unless [".", ".."].include?(file) end class FilmSnob class UrlToOembedProvider attr_reader :url, :options def initialize(url, options) @url = url @options = options end def media site.nil? ? nil : site.new(url, options.merge(:matched => true)) end private def site @site ||= OembedProvider.subclasses.find do |site| site.valid_url_patterns.any? do |pattern| pattern.match(url) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
film_snob-2.0.0 | lib/film_snob/url_to_oembed_provider.rb |
film_snob-1.0.1 | lib/film_snob/url_to_oembed_provider.rb |