Sha256: e7f47702cd93bcf0bee9bb89116472137dea9858df834da5cee1fcd5a2d63cca
Contents?: true
Size: 620 Bytes
Versions: 5
Compression:
Stored size: 620 Bytes
Contents
require "film_snob/vimeo" require "film_snob/youtube" require "film_snob/hulu" require "film_snob/funny_or_die" class FilmSnob class UrlToVideo VIDEO_SITES = [ Vimeo, YouTube, Hulu, FunnyOrDie ] attr_reader :url, :options def initialize(url, options) @url = url @options = options end def video site.nil?? nil : site.new(url, options) end private def site @site ||= VIDEO_SITES.find do |site| site.valid_url_patterns.any? do |pattern| pattern.match(url) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems