Class: Net::DAV::Item
- Inherits:
-
Object
show all
- Defined in:
- lib/vortex_client/item_extensions.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/vortex_client/item_extensions.rb', line 21
def method_missing(method, *args, &block)
result = property('.//v:' + method.to_s)
if(result != nil or result != "")then
return result
end
result = property('.//d:' + method.to_s)
if(result != nil or result != "")then
return result
end
result = property('.//' + method.to_s)
if(result != nil or result != "")then
return result
end
raise "Method missing: Net::DAV::Item." + method.to_s
return nil
end
|
Instance Method Details
#property(xpath) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/vortex_client/item_extensions.rb', line 7
def property(xpath)
namespaces = {'v' => "vrtx",'d' => "DAV:"}
xml = propfind
res = xml.xpath(xpath, namespaces)
if(res != nil)then
if(res.size > 0)then
return res.first.inner_text
else
return res.inner_text
end
end
return nil
end
|