Method: Jamf::Utility#hash_to_rexml_array
- Defined in:
- lib/jamf/utility.rb
#hash_to_rexml_array(hash) ⇒ Array<REXML::Element>
Given a simple Hash, convert it to an array of REXML Elements such that each key becomes an element, and its value becomes the text content of that element
491 492 493 494 495 496 497 498 499 500 501 |
# File 'lib/jamf/utility.rb', line 491 def hash_to_rexml_array(hash) raise InvalidDataError, 'Arg. must be a Hash.' unless hash.is_a? Hash ary = [] hash.each_pair do |k, v| el = REXML::Element.new k.to_s el.text = v ary << el end ary end |