Sha256: 22e705de13030dc6fdd1be27d4bfb6e06130886063cfb6e3931dd8935585ee21

Contents?: true

Size: 731 Bytes

Versions: 2

Compression:

Stored size: 731 Bytes

Contents

module Crawler
  class Cinema
    class Provider
      include Enumerable

      PROVIDERS = []

      def each
        PROVIDERS.each do |provider_name|
          camelized = ActiveSupport::Inflector.camelize("crawler/cinema/providers/#{provider_name.to_s}")
          yield ActiveSupport::Inflector.constantize(camelized)
        end
      end

      class Entries
        include Enumerable

        def initialize(method_name)
          @method_name = method_name
        end

        def each
          providers = Provider.new
          providers.each do |provider|
            provider.public_send(@method_name).each do |entry|
              yield entry
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crawler-cinema-core-0.1.1 lib/crawler/cinema/provider.rb
crawler-cinema-core-0.1.0 lib/crawler/cinema/provider.rb