Module: RichUrls
- Defined in:
- lib/el.rb,
lib/cache.rb,
lib/finders.rb,
lib/richurls.rb,
lib/parsers/url.rb,
lib/url_fetcher.rb,
lib/xml_handler.rb,
lib/body_decorator.rb,
lib/patron_browser.rb,
lib/finders/favicon.rb,
lib/parsers/property.rb,
lib/finders/meta_image.rb,
lib/finders/meta_title.rb,
lib/parsers/embed_parser.rb,
lib/finders/meta_description.rb,
lib/parsers/embed_parsers/base.rb,
lib/parsers/embed_parsers/paste.rb,
lib/parsers/embed_parsers/spotify.rb,
lib/parsers/embed_parsers/youtube.rb,
lib/parsers/provider_display_parser.rb,
lib/parsers/embed_parsers/youtube_short.rb
Defined Under Namespace
Modules: Cache, Finders, Parsers
Classes: BodyDecorator, Browser, El, MalformedURLError, PatronBrowser, UrlFetcher, XMLHandler
Constant Summary
collapse
- DEFAULT_TIMEOUT =
10
Class Method Summary
collapse
Class Method Details
.browser ⇒ Object
26
27
28
|
# File 'lib/richurls.rb', line 26
def self.browser
@browser || PatronBrowser.new
end
|
.browser=(browser) ⇒ Object
17
18
19
20
21
22
23
24
|
# File 'lib/richurls.rb', line 17
def self.browser=(browser)
unless browser.is_a? Browser
raise ArgumentError,
'browser needs to be of a RichUrls::Browser type'
end
@browser ||= browser
end
|
.cache ⇒ Object
13
14
15
|
# File 'lib/richurls.rb', line 13
def self.cache
@cache || Cache::None.new
end
|
.cache=(wrapper) ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'lib/richurls.rb', line 30
def self.cache=(wrapper)
unless wrapper.is_a? Cache::Wrapper
raise ArgumentError,
'caching wrapper needs to be an instance of Cache::Wrapper'
end
@cache ||= wrapper
end
|
.enrich(url, filter: [], cache_time: nil) ⇒ Object
47
48
49
50
51
52
53
|
# File 'lib/richurls.rb', line 47
def self.enrich(url, filter: [], cache_time: nil)
unless URI::DEFAULT_PARSER.make_regexp.match?(url)
raise MalformedURLError, "this url is malformed: #{url}"
end
UrlFetcher.fetch(url, filter, browser: browser, cache_time: cache_time)
end
|
43
44
45
|
# File 'lib/richurls.rb', line 43
def self.
@headers || {}
end
|
39
40
41
|
# File 'lib/richurls.rb', line 39
def self.()
@headers ||=
end
|