Module: XMLHelperInstanceMethods

Included in:
LaunchAgentManager
Defined in:
lib/kanseishitsu/xml_helper.rb,
lib/kanseishitsu/xml_helper_rexml.rb

Overview

Define module XMLHelperInstanceMethods

Constant Summary collapse

CDATA_PATTERN =
/[<>&'"\n]+/
KEYS_REQUIRING_CDATA =
['PATH'].freeze

Instance Method Summary collapse

Instance Method Details

#create_xml_tag(parent, key, value) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/kanseishitsu/xml_helper.rb', line 14

def create_xml_tag(doc, parent, key, value)
  element = case value
  when Hash then create_dict(doc, value)
  when Array then create_array(doc, value)
  else create_simple_element(doc, key, value)
  end
  parent << doc.create_element('key', key.to_s) unless element.nil?
  parent << element unless element.nil?
end