<commit_before>module Walk
  class VApp < Entity
    attr_accessor :name, :status, :description, :network_config, :vms

    def initialize vapp
      self.name = vapp.name
      self.status = vapp.status
      self.description = vapp.description
      self.network_config = extract_network_config(vapp.network_config)
      self.vms = Walk::Vms.new(vapp.vms.all(false))
    end

    private
    def extract_network_config network_config
      {
          network_name: network_config[:networkName],
          is_deployed: network_config[:IsDeployed],
          description: network_config[:Description],
          config: {
              ipscopes: network_config[:Configuration][:IpScopes]
          },
          parent_network: network_config[:Configuration][:ParentNetwork][:name]
      }
    end

  end

  class VApps < Collection
    def initialize vapps
      vapps.each do |v|
        self << Walk::VApp.new(v)
      end
    end
  end
end

<commit_msg>fix ability to walk one or more network configurations<commit_after>module Walk
  class VApp < Entity
    attr_accessor :name, :status, :description, :network_config, :vms

    def initialize vapp
      self.name = vapp.name
      self.status = vapp.status
      self.description = vapp.description
      self.network_config = extract_network_config(vapp.network_config)
      self.vms = Walk::Vms.new(vapp.vms.all(false))
    end

    private
    def extract_network_config network_configs
      (network_configs.is_a?(Hash)? [network_configs] : network_configs).collect do |network_config|
        {
            network_name: network_config[:networkName],
            is_deployed: network_config[:IsDeployed],
            description: network_config[:Description],
            config: {
                ipscopes: network_config[:Configuration][:IpScopes]
            },
            parent_network: network_config[:Configuration][:ParentNetwork]? network_config[:Configuration][:ParentNetwork][:name]: nil
        }
      end
    end

  end

  class VApps < Collection
    def initialize vapps
      vapps.each do |v|
        self << Walk::VApp.new(v)
      end
    end
  end
end


{'fraction_non_alphanumeric': 0.0911214953271028, 'fraction_numerical': 0.0, 'mean_word_length': 2.704152249134948, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, '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': '3344231', 'n_tokens_mistral': 631, 'n_tokens_neox': 623, 'n_words': 130}