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
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/open-uri/cached.rb', line 10 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:
9 |
# File 'lib/open-uri/cached.rb', line 9 alias original_open_uri open_uri |