Class: Jamnagar::Utilities::UrlExpander
- Inherits:
-
Object
- Object
- Jamnagar::Utilities::UrlExpander
- Defined in:
- lib/jamnagar/utilities/url_expander.rb
Instance Method Summary collapse
- #expand(url) ⇒ Object
-
#initialize(client = nil, cache = nil, parser = nil) ⇒ UrlExpander
constructor
A new instance of UrlExpander.
Constructor Details
#initialize(client = nil, cache = nil, parser = nil) ⇒ UrlExpander
Returns a new instance of UrlExpander.
7 8 9 10 11 |
# File 'lib/jamnagar/utilities/url_expander.rb', line 7 def initialize(client=nil,cache=nil,parser=nil) @client = client || HTTParty @cache = cache || Jamnagar::Storage::InMemoryCache.new @parser = parser || Nokogiri end |
Instance Method Details
#expand(url) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/jamnagar/utilities/url_expander.rb', line 12 def (url) cache_hit = nil cache_hit = = check_cache(url) if @cache = lookup(url) unless (url, ) unless cache_hit end |