class Lutaml::Model::XmlAdapter::Builder::Nokogiri
def self.build(options = {})
def self.build(options = {}) if block_given? ::Nokogiri::XML::Builder.new(options) do |xml| yield(new(xml)) end else new(::Nokogiri::XML::Builder.new(options)) end end
def add_element(element, child)
def add_element(element, child) element.add_child(child) end
def add_namespace_prefix(prefix)
def add_namespace_prefix(prefix) xml[prefix] if prefix self end
def add_text(element, text)
def add_text(element, text) if element.is_a?(self.class) element = element.xml.parent end add_element(element, ::Nokogiri::XML::Text.new(text.to_s, xml.doc)) end
def create_and_add_element(element_name, prefix: nil, attributes: {})
def create_and_add_element(element_name, prefix: nil, attributes: {}) add_namespace_prefix(prefix) if prefix if block_given? public_send(element_name, attributes) do yield(self) end else public_send(element_name, attributes) end end
def create_element(name, attributes = {})
def create_element(name, attributes = {}) xml.doc.create_element(name, attributes) end
def initialize(xml)
def initialize(xml) @xml = xml end
def method_missing(method_name, *args)
def method_missing(method_name, *args) if block_given? xml.public_send(method_name, *args) do yield(xml) end else xml.public_send(method_name, *args) end end
def respond_to_missing?(method_name, include_private = false)
def respond_to_missing?(method_name, include_private = false) xml.respond_to?(method_name) || super end