Class: TagFetcher
- Inherits:
-
Object
- Object
- TagFetcher
- Defined in:
- lib/tag_fetcher.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#fetch ⇒ Object
process a list of urls.
-
#initialize(urls) ⇒ TagFetcher
constructor
A new instance of TagFetcher.
Constructor Details
#initialize(urls) ⇒ TagFetcher
Returns a new instance of TagFetcher.
5 6 7 |
# File 'lib/tag_fetcher.rb', line 5 def initialize urls @urls = urls end |
Instance Method Details
#fetch ⇒ Object
process a list of urls
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/tag_fetcher.rb', line 10 def fetch new_cache = {} @urls.each do |url| begin = url rescue TagFetchError puts "Failed to retrieve repo tags from : #{url}" new_cache[url] = [:failed] else new_cache[url] = end end # return a dictionary with {"<url>": ["<tags>"]} # set "<tags>" to :failed in case of failure to retrieve tags new_cache end |