Module: Kernel
- Defined in:
- lib/data_collector/ext/x-open-uri-and-write.rb
Overview
Kernel extensions Careful monkeypatching
Class Method Summary collapse
Class Method Details
.open(name, *rest, &block) ⇒ Object
:doc:
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/data_collector/ext/x-open-uri-and-write.rb', line 20 def open(name, *rest, &block) # :doc: if name.respond_to?(:open) name.open(*rest, &block) elsif name.respond_to?(:to_s) and name.to_s[/^(https?):\/\//] and rest.size > 0 and rest.first.to_s[/^[rwa]/] webdav_agent = OpenUriAndWrite::Handle.new(name, rest) if(block) yield webdav_agent else return webdav_agent end else mode, = rest = {} unless .is_a?(Hash) open_uri_and_write_original(name.to_s, mode, **, &block) end end |