Sha256: 05800b1d028da46aeedb7d20b1d66a725ae38f6ecd42af7be160d5fd04b6d15b

Contents?: true

Size: 688 Bytes

Versions: 7

Compression:

Stored size: 688 Bytes

Contents

module BrowseEverything
  class Browser
    attr_reader :providers

    def initialize(opts = {})
      url_options = {}
      if opts.key?(:url_options)
        url_options = opts.delete(:url_options)
      else
        url_options = opts
        opts = BrowseEverything.config
      end

      @providers = {}
      opts.each_pair do |driver, config|
        begin
          driver_klass = BrowseEverything::Driver.const_get((config[:driver] || driver.to_s).camelize.to_sym)
          @providers[driver] = driver_klass.new(config.merge(url_options: url_options))
        rescue NameError
          Rails.logger.warn "Unknown provider: #{driver}"
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
browse-everything-0.15.1 lib/browse_everything/browser.rb
browse-everything-0.15.0 lib/browse_everything/browser.rb
browse-everything-0.14.2 lib/browse_everything/browser.rb
browse-everything-0.14.1 lib/browse_everything/browser.rb
browse-everything-0.14.0 lib/browse_everything/browser.rb
browse-everything-0.13.1 lib/browse_everything/browser.rb
browse-everything-0.13.0 lib/browse_everything/browser.rb