<commit_before>require 'json'

module Uptrends
  class Utils
    def self.gen_request_body(object)
      new_hash = object.original_keys.inject({}) do |memo,key|
        if key == 'Guid'
          memo
        else
          memo[key] = object.send(key.downcase.to_sym)
          memo
        end
      end

      request_body = JSON.dump(new_hash)
    end

    def self.to_s(object)
      string = []
      object.original_keys.each do |key|
        string << "#{key}: #{object.send(key.downcase.to_sym)}"
      end

      "#{string.join("\n")}"
    end

    # This method sets up all of our attr_accessor so we can easily edit probe attributes
    def self.gen_and_set_accessors(object)
      object.original_hash.each_pair do |k,v|

        k = k.underscore
        case k
        when "guid"
          puts "entering guid"
          object.class.send(:attr_reader, k)
          object.instance_variable_set("@#{k}", v)
        else
          object.class.send(:attr_accessor, k)
          object.send("#{k}=", v)<commit_msg>forgot to remove puts statement when I was testing<commit_after>require 'json'

module Uptrends
  class Utils
    def self.gen_request_body(object)
      new_hash = object.original_keys.inject({}) do |memo,key|
        if key == 'Guid'
          memo
        else
          memo[key] = object.send(key.downcase.to_sym)
          memo
        end
      end

      request_body = JSON.dump(new_hash)
    end

    def self.to_s(object)
      string = []
      object.original_keys.each do |key|
        string << "#{key}: #{object.send(key.downcase.to_sym)}"
      end

      "#{string.join("\n")}"
    end

    # This method sets up all of our attr_accessor so we can easily edit probe attributes
    def self.gen_and_set_accessors(object)
      object.original_hash.each_pair do |k,v|

        k = k.underscore
        case k
        when "guid"
          object.class.send(:attr_reader, k)
          object.instance_variable_set("@#{k}", v)
        else
          object.class.send(:attr_accessor, k)
          object.send("#{k}=", v)
{'fraction_non_alphanumeric': 0.11348205625606207, 'fraction_numerical': 0.0, 'mean_word_length': 2.125757575757576, 'pattern_counts': {'":': 0, '<': 7, '<?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': '196961', 'n_tokens_mistral': 670, 'n_tokens_neox': 667, 'n_words': 154}