<commit_before>require 'json'
require 'socket'

class Report
  attr_accessor :status, :data

  #
  # Create a new report
  # The attributes map to the ones of the report in the inventory
  #
  def initialize asset
    @asset = asset
    @starttime = Time.now
    @endtime = nil
    @status = :running

    ipaddress = nil
    Socket.ip_address_list.each do |ipaddr|
      if ipaddr.ipv4? && !ipaddr.ipv4_loopback?
        ipaddress = ipaddr
        break
      end
    end

    @data = { 
      reporter: {
        type: asset.type,
        ipaddress: ipaddress,
      },
    }

    return self
  end

  #
  # Add information to the report
  #<commit_msg>avoid encoding errors<commit_after>require 'json'
require 'socket'

class Report
  attr_accessor :status, :data

  #
  # Create a new report
  # The attributes map to the ones of the report in the inventory
  #
  def initialize asset
    @asset = asset
    @starttime = Time.now
    @endtime = nil
    @status = :running

    ipaddress = nil
    Socket.ip_address_list.each do |ipaddr|
      if ipaddr.ipv4? && !ipaddr.ipv4_loopback?
        ipaddress = ipaddr.ip_address
        break
      end
    end

    @data = { 
      reporter: {
        type: asset.type,
        ipaddress: ipaddress,
      },
    }

    return self
  end

  #
  # Add information to the report
  #
{'fraction_non_alphanumeric': 0.08051166290443942, 'fraction_numerical': 0.0030097817908201654, 'mean_word_length': 2.1367924528301887, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1491298', 'n_tokens_mistral': 434, 'n_tokens_neox': 424, 'n_words': 128}