module RackWebDAV::Utils

Public Instance Methods

to_element_hash(element) click to toggle source
# File lib/rack-webdav/utils.rb, line 13
def to_element_hash(element)
  ns = element.namespace
  DAVElement.new(
    :namespace => ns,
    :name => element.name, 
    :ns_href => (ns.href if ns), 
    :children => element.children.collect{|e| 
      to_element_hash(e) if e.element? 
    }.compact, 
    :attributes => attributes_hash(element)
  )
end
to_element_key(element) click to toggle source
# File lib/rack-webdav/utils.rb, line 26
def to_element_key(element)
  ns = element.namespace
  "#{ns.href if ns}!!#{element.name}"
end

Private Instance Methods

attributes_hash(node) click to toggle source
# File lib/rack-webdav/utils.rb, line 32
def attributes_hash(node)
  node.attributes.inject({}) do |ret, (key,attr)|
    ret[attr.name] = attr.value
    ret
  end
end