Sha256: 1ed2a0da2cb29d760e34ec78e5368973745b9578517e09ab65d2cb2768a91d55
Contents?: true
Size: 569 Bytes
Versions: 2
Compression:
Stored size: 569 Bytes
Contents
require "film_snob/vimeo" require "film_snob/youtube" require "film_snob/hulu" class FilmSnob class UrlToVideo VIDEO_SITES = [ Vimeo, YouTube, Hulu ] 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
film_snob-0.3.1 | lib/film_snob/url_to_video.rb |
film_snob-0.3.0 | lib/film_snob/url_to_video.rb |