Module: OpenURI
- Defined in:
- lib/open-uri/cached.rb
Defined Under Namespace
Classes: Cache
Class Method Summary collapse
Class Method Details
.open_uri(uri, *rest, &block) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/open-uri/cached.rb', line 8 def open_uri(uri, *rest, &block) response = Cache.get(uri.to_s) || Cache.set(uri.to_s, original_open_uri(uri, *rest)) if block_given? begin yield response ensure response.close end else response end end |
.original_open_uri ⇒ Object
:nodoc:
7 |
# File 'lib/open-uri/cached.rb', line 7 alias original_open_uri open_uri |