Module: DAV4Rack::Utils

Included in:
Controller, FileResource
Defined in:
lib/dav4rack/utils.rb

Instance Method Summary collapse

Instance Method Details

#to_element_hash(element) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/dav4rack/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) ⇒ Object



26
27
28
29
# File 'lib/dav4rack/utils.rb', line 26

def to_element_key(element)
  ns = element.namespace
  "#{ns.href if ns}!!#{element.name}"
end