module HTree::WabisabiModule
Public Instance Methods
generate(xml)
click to toggle source
# File vendor/qwik/lib/qwik/wabisabi-to-htree.rb, line 14 def generate(xml) return xml if xml.is_a?(String) return xml if xml.is_a?(Hash) return xml if xml.is_a?(Elem) if xml.is_a?(Array) && xml.length == 1 && xml[0].is_a?(Elem) return xml[0] end offset = 1 element = xml.shift.to_s attributes_ar = [] while xml.first.is_a?(Hash) attr = xml.shift attributes_ar << attr end if xml.empty? return make(element, *attributes_ar) end ar = xml.map {|i| generate(i) # recursive } return make(element, *attributes_ar){ar} end