Class: Dir
- Inherits:
-
Object
- Object
- Dir
- Defined in:
- lib/open-uri-and-write/dir_extensions.rb
Overview
Extensions and modifications (monkeypatching) to the Dir class:
Class Method Summary collapse
- .mkdir(name, *args) ⇒ Object
- .original_mkdir ⇒ Object
- .original_rmddir ⇒ Object
- .propfind(name) ⇒ Object
- .proppatch(name, xml_snippet) ⇒ Object
- .rmdir(name) ⇒ Object
Class Method Details
.mkdir(name, *args) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/open-uri-and-write/dir_extensions.rb', line 10 def self.mkdir(name, *args) if name.respond_to?(:to_s) and name[/^(https?):\/\//] dav = OpenUriAndWrite::CredentialsStore.get_connection_for_url(name) dav.mkdir(name) else self.original_mkdir(name, *args) end end |
.original_mkdir ⇒ Object
6 |
# File 'lib/open-uri-and-write/dir_extensions.rb', line 6 alias original_mkdir mkdir |
.original_rmddir ⇒ Object
7 |
# File 'lib/open-uri-and-write/dir_extensions.rb', line 7 alias original_rmddir rmdir |
.propfind(name) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/open-uri-and-write/dir_extensions.rb', line 28 def self.propfind(name) if name.respond_to?(:to_s) and name[/^(https?):\/\//] dav = OpenUriAndWrite::CredentialsStore.get_connection_for_url(name) dav.propfind(name) else raise IOError.new(true), "Illegal action: Can't do propfind #{name}" end end |
.proppatch(name, xml_snippet) ⇒ Object
37 38 39 40 41 42 43 44 |
# File 'lib/open-uri-and-write/dir_extensions.rb', line 37 def self.proppatch(name,xml_snippet) if name.respond_to?(:to_s) and name[/^(https?):\/\//] dav = OpenUriAndWrite::CredentialsStore.get_connection_for_url(name) dav.propfind(name, xml_snippet) else raise IOError.new(true), "Illegal action: Can't do proppatch on #{name}" end end |
.rmdir(name) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/open-uri-and-write/dir_extensions.rb', line 19 def self.rmdir(name) if name.respond_to?(:to_s) and name[/^(https?):\/\//] dav = OpenUriAndWrite::CredentialsStore.get_connection_for_url(name) dav.delete(name) else self.original_rmdir(name) end end |