Sha256: f38bdaf8cb7a10ea56a58160c9044778a80084d8208991a6a28f4eb80a89bc97

Contents?: true

Size: 515 Bytes

Versions: 5

Compression:

Stored size: 515 Bytes

Contents

Dir[File.join(File.dirname(__FILE__), "video_sites", "*.rb")].each do |file|
  require file
end

class FilmSnob
  class UrlToVideo
    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 ||= VideoSite.subclasses.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

Version Path
film_snob-0.6.4 lib/film_snob/url_to_video.rb
film_snob-0.6.3 lib/film_snob/url_to_video.rb
film_snob-0.6.2 lib/film_snob/url_to_video.rb
film_snob-0.6.1 lib/film_snob/url_to_video.rb
film_snob-0.6.0 lib/film_snob/url_to_video.rb