Sha256: 1d9b88b1a261803288b05fef225da18d0de846c5e0d02d098400cee1466a2859

Contents?: true

Size: 905 Bytes

Versions: 8

Compression:

Stored size: 905 Bytes

Contents

module Net
  class DAV
    # Hold items found using Net::DAV#find
    class Item
      # URI of item
      attr_reader :uri

      # Size of item if a file
      attr_reader :size

      # Type of item - :directory or :file
      attr_reader :type

      # Synonym for uri
      def url
	@uri
      end

      def initialize(dav, uri, type, size) #:nodoc:
	@uri = uri
	@size = size.to_i rescue nil
	@type = type
	@dav = dav
      end

      # Get content from server if needed and return as string
      def content
	return @content unless @content.nil?
	@content = @dav.get(@uri.path)
      end

      # Put content to server
      def content=(str)
	@dav.put_string(@uri.path, str)
	@content = str
      end

      def to_s #:nodoc:
	"#<Net::DAV::Item URL:#{@uri.to_s} type:#{@type}>"
      end

      def inspect #:nodoc:
	"#<Net::DAV::Item URL:#{@uri.to_s} type:#{@type}>"
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
net_dav-0.3.3 lib/net/dav/item.rb
net_dav-0.3.2 lib/net/dav/item.rb
net_dav-0.3.1 lib/net/dav/item.rb
net_dav-0.3.0 lib/net/dav/item.rb
net_dav-0.2.2 lib/net/dav/item.rb
net_dav-0.2.1 lib/net/dav/item.rb
net_dav-0.2.0 lib/net/dav/item.rb
net_dav-0.1.1 lib/net/dav/item.rb