module Scruber::Fetcher
Attributes
adapter[W]
Public Class Methods
[](label)
click to toggle source
# File lib/scruber/fetcher.rb, line 25 def [](label) _adapters[label] end
_adapters()
click to toggle source
# File lib/scruber/fetcher.rb, line 29 def _adapters @_adapters ||= {} end
adapter()
click to toggle source
# File lib/scruber/fetcher.rb, line 10 def adapter unless @adapter @adapter = ::Scruber.configuration.fetcher_adapter || _adapters.keys.first end raise Scruber::ArgumentError.new("Adapter not found") unless @adapter _adapters[@adapter] end
add_adapter(label, claz)
click to toggle source
# File lib/scruber/fetcher.rb, line 18 def add_adapter(label, claz) unless claz.method_defined?(:run) raise NoMethodError, "run is not declared in the #{label.inspect}" end _adapters[label] = claz end
new(options={})
click to toggle source
# File lib/scruber/fetcher.rb, line 6 def new(options={}) adapter.new(::Scruber.configuration.fetcher_options.merge(options)) end