<commit_before>require 'nokogiri'
require 'meac_control/xml/exceptions'

module MEACControl
  module XML
    class AbstractRequest
      attr_reader :devices, :commands

      def initialize(devices, commands)
        @devices = [devices].compact.flatten
        @commands = [commands].compact.flatten

        raise MEACControl::XML::Request::EmptyDeviceList if @devices.empty?
        raise MEACControl::XML::Request::EmptyCommandList if @commands.empty?
      end

      def xml_template(command)
        ::Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do
          Packet do
            Command command
            DatabaseManager do
              devices.each do |dev|
                attributes = {:Group => dev.id}
                commands.each do |cmd|
                  attributes.merge!(cmd.to_get_hash)
                end
                Mnet(attributes)
              end
            end
          end
        end.to_xml
      end
    end
  end
end
<commit_msg>Make xml_template a private method.<commit_after>require 'nokogiri'
require 'meac_control/xml/exceptions'

module MEACControl
  module XML
    class AbstractRequest
      attr_reader :devices, :commands

      def initialize(devices, commands)
        @devices = [devices].compact.flatten
        @commands = [commands].compact.flatten

        raise MEACControl::XML::Request::EmptyDeviceList if @devices.empty?
        raise MEACControl::XML::Request::EmptyCommandList if @commands.empty?
      end

      private
        def xml_template(command)
          ::Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do
            Packet do
              Command command
              DatabaseManager do
                devices.each do |dev|
                  attributes = {:Group => dev.id}
                  commands.each do |cmd|
                    attributes.merge!(cmd.to_get_hash)
                  end
                  Mnet(attributes)
                end
              end
            end
          end.to_xml
        end
    end
  end
end

{'fraction_non_alphanumeric': 0.08259149357072205, 'fraction_numerical': 0.0009891196834817012, 'mean_word_length': 1.7826685006877578, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 7}, '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': '6331966', 'n_tokens_mistral': 544, 'n_tokens_neox': 517, 'n_words': 125}