<commit_before>module IControl # :nodoc:

  class ArrayMapper # :nodoc: 
    def self.map_object(result)
      case result[:array_type]
      when /string/ then result[:item]
      when /iControl:LocalLB\.ProfileMatchPatternStringArray/ then map_object(result[:item][:values])
      when /iControl:LocalLB\.MatchPatternString/ then [result[:item]].flatten.compact.map{|i| IControl::LocalLB::MatchPatternString.new(i) }
      when /iControl:Common\.IPPortDefinition\[\]/ then [result[:item][:item]].flatten.map{|i| IControl::LocalLB::PoolMember.new(i)}
      when /iControl:LocalLB.LBMethod/ then [result[:item]].flatten
      when /VirtualServerProfileAttribute\[\]/ then [result[:item][:item]].flatten.map{|i| IControl::LocalLB::VirtualServer::ProfileAttribute.new(i) }
      when /iControl:LocalLB.VirtualServer.VirtualServerHttpClass\[\]/ then [result[:item][:item]].flatten.compact.sort{|a,b| a[:priority] <=> b[:priority]}.map{ |i| IControl::LocalLB::ProfileHttpClass.new(i)}
      when /iControl:LocalLB\.ProfileString\[/ then [result[:item]].flatten.map do |i| 
          if i[:value].class == String
            IControl::LocalLB::Pool.new(i.merge({:id => i[:value] }))
          end
        end.compact
      when /iControl:LocalLB\.PoolMember\.MemberObjectStatus\[\]\[/ then  [result[:item][:item]].map do |j| 
          IControl::LocalLB::PoolMember.new( j[:member].merge(:status => j[:object_status])  ) 
        end
      when /iControl:LocalLB\.Pool\.MonitorAssociation\[/ then IControl::LocalLB::MonitorRule.from_xml(result[:item][:monitor_rule])
      when /iControl:LocalLB\.ObjectStatus\[/ then (result[:item])
      when /iControl:LocalLB.VirtualServer.VirtualServerType\[/ then IControl::LocalLB::VirtualServer::Type.const_get(result[:item])
      when /iControl:LocalLB.VirtualServer.VirtualServerCMPEnableMode\[/ then IControl::LocalLB::VirtualServer::CMPEnableMode.const_get(result[:item])
      when /iControl:Common\.IPPortDefinition\[/ then IControl::Common::IPPortDefinition.new(result[:item])<commit_msg>Solved a bug that returned an array when no IPPort was returned<commit_after>module IControl # :nodoc:

  class ArrayMapper # :nodoc: 
    def self.map_object(result)
      case result[:array_type]
      when /string/ then result[:item]
      when /iControl:LocalLB\.ProfileMatchPatternStringArray/ then map_object(result[:item][:values])
      when /iControl:LocalLB\.MatchPatternString/ then [result[:item]].flatten.compact.map{|i| IControl::LocalLB::MatchPatternString.new(i) }
      when /iControl:Common\.IPPortDefinition\[\]/ then result[:item][:item] ? [result[:item][:item]].flatten.map{|i| IControl::LocalLB::PoolMember.new(i)} : [] 
      when /iControl:LocalLB.LBMethod/ then [result[:item]].flatten
      when /VirtualServerProfileAttribute\[\]/ then [result[:item][:item]].flatten.map{|i| IControl::LocalLB::VirtualServer::ProfileAttribute.new(i) }
      when /iControl:LocalLB.VirtualServer.VirtualServerHttpClass\[\]/ then [result[:item][:item]].flatten.compact.sort{|a,b| a[:priority] <=> b[:priority]}.map{ |i| IControl::LocalLB::ProfileHttpClass.new(i)}
      when /iControl:LocalLB\.ProfileString\[/ then [result[:item]].flatten.map do |i| 
          if i[:value].class == String
            IControl::LocalLB::Pool.new(i.merge({:id => i[:value] }))
          end
        end.compact
      when /iControl:LocalLB\.PoolMember\.MemberObjectStatus\[\]\[/ then  [result[:item][:item]].map do |j| 
          IControl::LocalLB::PoolMember.new( j[:member].merge(:status => j[:object_status])  ) 
        end
      when /iControl:LocalLB\.Pool\.MonitorAssociation\[/ then IControl::LocalLB::MonitorRule.from_xml(result[:item][:monitor_rule])
      when /iControl:LocalLB\.ObjectStatus\[/ then (result[:item])
      when /iControl:LocalLB.VirtualServer.VirtualServerType\[/ then IControl::LocalLB::VirtualServer::Type.const_get(result[:item])
      when /iControl:LocalLB.VirtualServer.VirtualServerCMPEnableMode\[/ then IControl::LocalLB::VirtualServer::CMPEnableMode.const_get(result[:item])
      when /iControl:Common\.IPPortDefinition\[/ then IControl::Common::IPPortDefinition.new(result[:item])
{'fraction_non_alphanumeric': 0.16895969104513636, 'fraction_numerical': 0.0, 'mean_word_length': 4.653478854024557, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '322979', 'n_tokens_mistral': 1361, 'n_tokens_neox': 1274, 'n_words': 187}