class Calendav::Parsers::CalendarXML
Constants
- XPATHS
Attributes
element[R]
Public Class Methods
call(...)
click to toggle source
# File lib/calendav/parsers/calendar_xml.rb, line 16 def self.call(...) new(...).call end
new(element)
click to toggle source
# File lib/calendav/parsers/calendar_xml.rb, line 20 def initialize(element) @element = element end
Public Instance Methods
call()
click to toggle source
# File lib/calendav/parsers/calendar_xml.rb, line 24 def call XPATHS .transform_values { |xpath| value(xpath) } .merge(components: components, reports: reports) end
Private Instance Methods
components()
click to toggle source
# File lib/calendav/parsers/calendar_xml.rb, line 34 def components element.xpath( ".//caldav:supported-calendar-component-set/caldav:comp" ).collect { |node| node["name"] } end
reports()
click to toggle source
# File lib/calendav/parsers/calendar_xml.rb, line 40 def reports element.xpath( ".//dav:supported-report-set/dav:supported-report/dav:report/*" ).collect(&:name) end
value(xpath)
click to toggle source
# File lib/calendav/parsers/calendar_xml.rb, line 46 def value(xpath) node = element.xpath(xpath) return nil if node.children.empty? if node.children.any?(&:element?) node.children.select(&:element?).collect(&:to_xml).join else node.children.text end end