Module: OM::XML::NodeGenerator

Defined in:
lib/om/xml/node_generator.rb

Class Method Summary collapse

Class Method Details

.generate(term, builder_new_value, opts = {}) ⇒ Nokogiri::XML::Document

Module Methods – These methods can be called directly on the Module itself Ex. term = t.retrieve_term(:person, :first_name) OM::XML::NodeGenerator.generate(term, “John”)

Parameters:

  • term (OM::XML::Term)

    The term to generate a node based on

  • builder_new_value (String)

    The new value to insert into the generated node

Returns:

  • (Nokogiri::XML::Document)


11
12
13
14
15
16
17
18
19
# File 'lib/om/xml/node_generator.rb', line 11

def self.generate(term, builder_new_value, opts={})
  template = term.xml_builder_template(opts)
  builder_call_body = eval('"' + template + '"')
  builder = Nokogiri::XML::Builder.new do |xml|
    eval( builder_call_body )
  end
  
  return builder.doc
end