Sha256: 55766488a8ef81d6eb96fc4e1d0cafe0a2b174f8d42e845ea31cc250bf451d1d

Contents?: true

Size: 889 Bytes

Versions: 1

Compression:

Stored size: 889 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
	@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

1 entries across 1 versions & 1 rubygems

Version Path
net_dav-0.1.0 lib/net/dav/item.rb