Sha256: 52ad0ca09c6a5bd5811eaa2aa045f656e6020cf73efd855734670c1ae40a8f85
Contents?: true
Size: 516 Bytes
Versions: 7
Compression:
Stored size: 516 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 def initialize(url) @url = url end def video site.nil?? nil : site.new(url) 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
7 entries across 7 versions & 1 rubygems