class Tilia::Dav::Xml::Property::ResourceType
{DAV:}resourcetype property
This class represents the {DAV:}resourcetype property, as defined in:
Attributes
Returns the values in clark-notation
For example array('{DAV:}collection')
@return array
Public Class Methods
Constructor
You can either pass null (for no resourcetype), a string (for a single resourcetype) or an array (for multiple).
The resourcetype must be specified in clark-notation
@param array|string|null resource_type
# File lib/tilia/dav/xml/property/resource_type.rb, line 21 def initialize(resource_types = nil) resource_types = [] if resource_types.nil? resource_types = [resource_types] unless resource_types.is_a?(Array) super(resource_types) end
The deserialize method is called during xml parsing.
This method is called statictly, this is because in theory this method may be used as a type of constructor, or factory method.
Often you want to return an instance of the current class, but you are free to return other data as well.
Important note 2: You are responsible for advancing the reader to the next element. Not doing anything will result in a never-ending loop.
If you just want to skip parsing for this element altogether, you can just call reader.next
reader.parse_inner_tree will parse the entire sub-tree, and advance to the next element.
@param Reader reader @return mixed
# File lib/tilia/dav/xml/property/resource_type.rb, line 70 def self.xml_deserialize(reader) new(super(reader)) end
Public Instance Methods
Adds a resourcetype value to this property
@param string type @return void
# File lib/tilia/dav/xml/property/resource_type.rb, line 46 def add(type) @value << type @value = @value.uniq end
Checks if the principal contains a certain value
@param string type @return bool
# File lib/tilia/dav/xml/property/resource_type.rb, line 38 def is(type) @value.include?(type) end
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/resource_type.rb, line 86 def to_html(html) tmp = value.map do |value| html.xml_name(value) end tmp.join(', ') end