Module: Jazzy::XMLHelper

Defined in:
lib/jazzy/xml_helper.rb

Class Method Summary collapse

Class Method Details

.attribute(node, name) ⇒ Object

Gets value of XML attribute or nil (i.e. file in <Class file=“Musician.swift”></Class>)



7
8
9
# File 'lib/jazzy/xml_helper.rb', line 7

def self.attribute(node, name)
  node.attributes[name].value if node.attributes[name]
end

.xpath(node, xpath) ⇒ Object

Gets text in XML node or nil (i.e. s:cMyUSR <USR>s:cMyUSR</USR>)



12
13
14
# File 'lib/jazzy/xml_helper.rb', line 12

def self.xpath(node, xpath)
  node.xpath(xpath).text if node.xpath(xpath).text.length > 0
end