Sha256: 2da8df8f2d5589b63bc1036ef8244fb4875cadf93a575c6b49f3e9ada879b9fc

Contents?: true

Size: 794 Bytes

Versions: 2

Compression:

Stored size: 794 Bytes

Contents

# frozen_string_literal: true

# Extensions of the Nokogiri gem for use with this project.
module Nokogiri
  # Customizations to the Nokogiri XML namespace.
  module XML
    # Helpers for operating on XML Elements
    class Element
      # Adds a simple Text Node as a child element
      #
      # @param [String] element The XML tag name to use.
      # @param [String] content The text contents of the XML tag.
      # @example Look up an existing file
      #   # To Generate <text>Hello World</text>:
      #   xml.add_leaf_node(element: 'text', content: 'Hello World')
      # @api private
      # @return [Void]
      def add_leaf_node(element:, content:)
        node = document.create_element(element)
        node.content = content
        add_child(node)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xliff-1.0.3 lib/xliff/xml_extensions.rb
xliff-1.0.0 lib/xliff/xml_extensions.rb