class Tilia::Dav::Xml::Property::SupportedMethodSet

supported-method-set property.

This property is defined in RFC3253, but since it's so common in other webdav-related specs, it is part of the core server.

This property is defined here: tools.ietf.org/html/rfc3253#section-3.1.3

Public Class Methods

new(methods = nil) click to toggle source

Creates the property

Any reports passed in the constructor should be valid report-types in clark-notation.

Either a string or an array of strings must be passed.

@param string|string[] methods

# File lib/tilia/dav/xml/property/supported_method_set.rb, line 29
def initialize(methods = nil)
  if methods.nil?
    methods = []
  elsif !methods.is_a?(Array)
    methods = [methods]
  end

  @methods = methods
end

Public Instance Methods

has(method_name) click to toggle source

Returns true or false if the property contains a specific method.

@param string method_name @return bool

# File lib/tilia/dav/xml/property/supported_method_set.rb, line 50
def has(method_name)
  @methods.include?(method_name)
end
to_html(html) click to toggle source

Generate html representation for this value.

The html output is 100% trusted, and no effort is being made to sanitize it. It's up to the implementor to sanitize user provided values.

The output must be in UTF-8.

The baseUri parameter is a url to the root of the application, and can be used to construct local links.

@param HtmlOutputHelper html @return string

# File lib/tilia/dav/xml/property/supported_method_set.rb, line 91
def to_html(html)
  tmp = value.map do |value|
    html.h(value)
  end
  tmp.join(', ')
end
value() click to toggle source

Returns the list of supported http methods.

@return string[]

# File lib/tilia/dav/xml/property/supported_method_set.rb, line 42
def value
  @methods
end
xml_serialize(writer) click to toggle source

The xmlSerialize metod is called during xml writing.

Use the writer argument to write its own xml serialization.

An important note: do not create a parent element. Any element implementing XmlSerializble should only ever write what's considered its 'inner xml'.

The parent of the current element is responsible for writing a containing element.

This allows serializers to be re-used for different element names.

If you are opening new elements, you must also close them again.

@param Writer writer @return void

# File lib/tilia/dav/xml/property/supported_method_set.rb, line 71
def xml_serialize(writer)
  value.each do |val|
    writer.start_element('{DAV:}supported-method')
    writer.write_attribute('name', val)
    writer.end_element
  end
end