Method: Jamf::Utility#array_to_rexml_array
- Defined in:
- lib/jamf/utility.rb
#array_to_rexml_array(element, list) ⇒ Array<REXML::Element>
Given an element name and an array of content, generate an Array of REXML::Element objects with that name, and matching content. Given element name ‘foo’ and the array [‘bar’,‘morefoo’] The array of REXML elements would render thus:
<foo>bar</foo>
<foo>morefoo</foo>
464 465 466 467 468 469 470 471 472 473 |
# File 'lib/jamf/utility.rb', line 464 def array_to_rexml_array(element, list) raise Jamf::InvalidDataError, 'Arg. must be an Array.' unless list.is_a? Array element = element.to_s list.map do |v| e = REXML::Element.new(element) e.text = v e end end |