<commit_before>#
# Copyright (c) 2013 by Lifted Studios. All Rights Reserved.
#

module KangaRuby
  # Container for common XML functionality.
  module XmlUtilities
    # Adds a child node described by `args` to `element`.
    #
    # @param [Nokogiri::XML::Element] element Element to which to add the child.
    # @param [Array<String, Hash>] args Node name followed by attributes of the node in a Hash.
    # @return [nil]
    def add_child(element, *args)
      element.add_child(element.document.create_element(*args))

      nil
    end
  end
end<commit_msg>Return the element that was added to allow better chaining<commit_after>#
# Copyright (c) 2013 by Lifted Studios. All Rights Reserved.
#

module KangaRuby
  # Container for common XML functionality.
  module XmlUtilities
    # Adds a child node described by `args` to `element`.
    #
    # @param [Nokogiri::XML::Element] element Element to which to add the child.
    # @param [Array<String, Hash>] args Node name followed by attributes of the node in a Hash.
    # @return [Nokogiri::XML::Element] Element that was added.
    def add_child(element, *args)
      element.add_child(element.document.create_element(*args))
    end
  end
end
{'fraction_non_alphanumeric': 0.09060681629260182, 'fraction_numerical': 0.006650041562759767, 'mean_word_length': 3.6130268199233715, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2988921', 'n_tokens_mistral': 369, 'n_tokens_neox': 353, 'n_words': 137}