class Tilia::Dav::File

File class

This is a helper class, that should aid in getting file classes setup. Most of its methods are implemented, and throw permission denied exceptions

Public Instance Methods

content_type() click to toggle source

Returns the mime-type for a file

If null is returned, we'll assume application/octet-stream

@return string|null

# File lib/tilia/dav/file.rb, line 53
def content_type
  nil
end
etag() click to toggle source

Returns the ETag for a file

An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change. The ETag is an arbitrary string, but MUST be surrounded by double-quotes.

Return null if the ETag can not effectively be determined

@return string|null

# File lib/tilia/dav/file.rb, line 44
def etag
  nil
end
get() click to toggle source

Returns the data

This method may either return a string or a readable stream resource

@return mixed

# File lib/tilia/dav/file.rb, line 25
def get
  fail Exception::Forbidden, 'Permission denied to read this file'
end
put(_data) click to toggle source

Updates the data

data is a readable stream resource.

@param resource data @return void

# File lib/tilia/dav/file.rb, line 16
def put(_data)
  fail Exception::Forbidden, 'Permission denied to change data'
end
size() click to toggle source

Returns the size of the file, in bytes.

@return int

# File lib/tilia/dav/file.rb, line 32
def size
  0
end