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

Version Path
film_snob-0.2.1 lib/film_snob/url_to_video.rb
film_snob-0.2.0 lib/film_snob/url_to_video.rb
film_snob-0.1.4 lib/film_snob/url_to_video.rb
film_snob-0.1.3 lib/film_snob/url_to_video.rb
film_snob-0.1.2 lib/film_snob/url_to_video.rb
film_snob-0.1.1 lib/film_snob/url_to_video.rb
film_snob-0.1.0 lib/film_snob/url_to_video.rb