Module: Nuggets::URI::ExistMixin
- Included in:
- URI
- Defined in:
- lib/nuggets/uri/exist_mixin.rb
Instance Method Summary collapse
-
#exist?(uri) ⇒ Boolean
(also: #exists?)
call-seq: URI.exist?(uri) => true or false.
Instance Method Details
#exist?(uri) ⇒ Boolean Also known as: exists?
call-seq:
URI.exist?(uri) => true or false
Return true if the named URI exists.
38 39 40 41 42 43 |
# File 'lib/nuggets/uri/exist_mixin.rb', line 38 def exist?(uri) open(uri.to_s) true rescue OpenURI::HTTPError, SocketError, Errno::ENOENT false end |