<commit_before>module Bra
  module Models
    # Internal: An object in the BRA model.
    class ModelObject
      # Public: Allows read access to the object's name.
      attr_reader :name

      # Public: Allows read access to the object's short name.
      attr_reader :short_name

      def initialize(name, short_name=nil)
        short_name ||= name

        @name = name
        @short_name = short_name
      end

      # Public: Converts a model object to JSON.
      #
      # This expects a to_hash method to be defined.
      #
      # Returns the JSON representation of the model object.
      def to_json
        to_hash.to_json
      end
    end
  end
end<commit_msg>Fix general case of to_json for model objects.<commit_after>module Bra
  module Models
    # Internal: An object in the BRA model.
    class ModelObject
      # Public: Allows read access to the object's name.
      attr_reader :name

      # Public: Allows read access to the object's short name.
      attr_reader :short_name

      def initialize(name, short_name=nil)
        short_name ||= name

        @name = name
        @short_name = short_name
      end

      # Public: Converts a model object to JSON.
      #
      # This expects a to_hash method to be defined.
      #
      # Returns the JSON representation of the model object.
      def to_json(*args)
        to_hash.to_json(*args)
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.057487579843860895, 'fraction_numerical': 0.0, 'mean_word_length': 2.1263858093126387, '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': '4768207', 'n_tokens_mistral': 410, 'n_tokens_neox': 395, 'n_words': 154}