Sha256: 6f5ad760d3d272edf88fc7d8560ae4e60e02b60bf9e7c0b8ce9df5950d99468a

Contents?: true

Size: 690 Bytes

Versions: 22

Compression:

Stored size: 690 Bytes

Contents

module BrowseEverything
  class Browser
    attr_reader :providers
    
    def initialize(opts = {})
      url_options = {}
      if opts.has_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
          Rails.logger.warn "Unknown provider: #{driver.to_s}"
        end
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
browse-everything-0.5.1 lib/browse_everything/browser.rb
browse-everything-0.5.0 lib/browse_everything/browser.rb