Class: Net::DAV::Item
- Inherits:
-
Object
- Object
- Net::DAV::Item
- Defined in:
- lib/net/dav/item.rb
Overview
Hold items found using Net::DAV#find
Instance Attribute Summary collapse
-
#size ⇒ Object
readonly
Size of item if a file.
-
#type ⇒ Object
readonly
Type of item - :directory or :file.
-
#uri ⇒ Object
readonly
URI of item.
Instance Method Summary collapse
-
#content ⇒ Object
Get content from server if needed and return as string.
-
#content=(str) ⇒ Object
Put content to server.
-
#initialize(dav, uri, type, size) ⇒ Item
constructor
:nodoc:.
-
#inspect ⇒ Object
:nodoc:.
-
#propfind ⇒ Object
Properties for this item.
-
#proppatch(xml_snippet) ⇒ Object
Proppatch item.
-
#to_s ⇒ Object
:nodoc:.
-
#url ⇒ Object
Synonym for uri.
Constructor Details
#initialize(dav, uri, type, size) ⇒ Item
:nodoc:
19 20 21 22 23 24 |
# File 'lib/net/dav/item.rb', line 19 def initialize(dav, uri, type, size) #:nodoc: @uri = uri @size = size.to_i rescue nil @type = type @dav = dav end |
Instance Attribute Details
#size ⇒ Object (readonly)
Size of item if a file
9 10 11 |
# File 'lib/net/dav/item.rb', line 9 def size @size end |
#type ⇒ Object (readonly)
Type of item - :directory or :file
12 13 14 |
# File 'lib/net/dav/item.rb', line 12 def type @type end |
#uri ⇒ Object (readonly)
URI of item
6 7 8 |
# File 'lib/net/dav/item.rb', line 6 def uri @uri end |
Instance Method Details
#content ⇒ Object
Get content from server if needed and return as string
27 28 29 30 |
# File 'lib/net/dav/item.rb', line 27 def content return @content unless @content.nil? @content = @dav.get(@uri.path) end |
#content=(str) ⇒ Object
Put content to server
33 34 35 36 |
# File 'lib/net/dav/item.rb', line 33 def content=(str) @dav.put_string(@uri.path, str) @content = str end |
#inspect ⇒ Object
:nodoc:
52 53 54 |
# File 'lib/net/dav/item.rb', line 52 def inspect #:nodoc: "#<Net::DAV::Item URL:#{@uri.to_s} type:#{@type}>" end |
#propfind ⇒ Object
Properties for this item
44 45 46 |
# File 'lib/net/dav/item.rb', line 44 def propfind return @dav.propfind(@uri.path) end |
#proppatch(xml_snippet) ⇒ Object
Proppatch item
39 40 41 |
# File 'lib/net/dav/item.rb', line 39 def proppatch(xml_snippet) @dav.proppatch(@uri.path,xml_snippet) end |
#to_s ⇒ Object
:nodoc:
48 49 50 |
# File 'lib/net/dav/item.rb', line 48 def to_s #:nodoc: "#<Net::DAV::Item URL:#{@uri.to_s} type:#{@type}>" end |
#url ⇒ Object
Synonym for uri
15 16 17 |
# File 'lib/net/dav/item.rb', line 15 def url @uri end |