Module: RUtilAnts::URLCache
- Defined in:
- lib/rUtilAnts/URLCache.rb,
lib/rUtilAnts/URLHandlers/FTP.rb,
lib/rUtilAnts/URLHandlers/HTTP.rb,
lib/rUtilAnts/URLHandlers/DataImage.rb,
lib/rUtilAnts/URLHandlers/LocalFile.rb
Defined Under Namespace
Modules: URLHandlers Classes: URLCache
Class Method Summary collapse
-
.initializeURLCache ⇒ Object
Initialize a global cache.
Instance Method Summary collapse
-
#getURLContent(iURL, iParameters = {}) ⇒ Object
Get a content from a URL.
Class Method Details
Instance Method Details
#getURLContent(iURL, iParameters = {}) ⇒ Object
Get a content from a URL. Here are the different formats the URL can have:
-
Local file name
-
http/https/ftp/ftps:// protocols
-
data:image URI
-
file:// protocol
It also handles redirections or zipped files
Parameters:
-
iURL (String): The URL
-
iParameters (map<Symbol,Object>): Additional parameters:
** :ForceLoad (Boolean): Do we force to refresh the cache ? [optional = false] ** :FollowRedirections (Boolean): Do we follow redirections ? [optional = true] ** :NbrRedirectionsAllowed (Integer): Number of redirections allowed [optional = 10] ** :LocalFileAccess (Boolean): Do we need a local file to read the content from ? If not, the content itself will be given the code block. [optional = false]
-
CodeBlock: The code returning the object corresponding to the content:
** iContent (String): File content, or file name if :LocalFileAccess was true ** Returns: ** Object: Object read from the content, or nil in case of error ** Exception: The error encountered, or nil in case of success Return:
-
Object: The corresponding URL content, or nil in case of failure
-
Exception: The error, or nil in case of success
137 138 139 140 141 |
# File 'lib/rUtilAnts/URLCache.rb', line 137 def getURLContent(iURL, iParameters = {}) return $rUtilAnts_URLCache.getURLContent(iURL, iParameters) do |iContent| next yield(iContent) end end |