Skip to content

Instantly share code, notes, and snippets.

@ratnikov
Forked from eladmeidar/fetchers.rb
Created February 9, 2011 21:00
Show Gist options
  • Save ratnikov/819265 to your computer and use it in GitHub Desktop.
Save ratnikov/819265 to your computer and use it in GitHub Desktop.
@available_fetchers = Fetcherr.all
if @available_fetchers.empty?
puts "No fetchers found"
else
@available_fetchers.each do |fetcher|
puts "Loading the #{fetcher.name} fetcher"
klass = Class.new do
include HTTParty
base_uri fetcher.url
@auth = {:username => fetcher.username, :password => fetcher.password}
end
const_set(fetcher.name, klass)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment