<commit_before>module ActsAsApi
  # Represents an api template for a model.
  # This class should not be initiated by yourself, api templates
  # are created by defining them in the model by calling: +api_accessible+.
  #
  # The api template is configured in the block passed to +api_accessible+.
  #
  # Please note that +ApiTemplate+ inherits from +Hash+ so you can use all
  # kind of +Hash+ and +Enumerable+ methods to manipulate the template.
  class ApiTemplate < Hash

    # The name of the api template as a Symbol.
    attr_accessor :api_template

    attr_reader :options

    def initialize(api_template = nil)
      self.api_template = api_template
      @options ||= {}
    end

    def merge!(other_hash, &block)
      super
      self.options.merge!(other_hash.options) if other_hash.respond_to?(:options)
    end

    # Adds a field to the api template<commit_msg>Makes api_template name a required attribute<commit_after>module ActsAsApi
  # Represents an api template for a model.
  # This class should not be initiated by yourself, api templates
  # are created by defining them in the model by calling: +api_accessible+.
  #
  # The api template is configured in the block passed to +api_accessible+.
  #
  # Please note that +ApiTemplate+ inherits from +Hash+ so you can use all
  # kind of +Hash+ and +Enumerable+ methods to manipulate the template.
  class ApiTemplate < Hash

    # The name of the api template as a Symbol.
    attr_accessor :api_template

    attr_reader :options

    def initialize(api_template)
      self.api_template = api_template
      @options ||= {}
    end

    def merge!(other_hash, &block)
      super
      self.options.merge!(other_hash.options) if other_hash.respond_to?(:options)
    end

    # Adds a field to the api template
{'fraction_non_alphanumeric': 0.06883044208170118, 'fraction_numerical': 0.0, 'mean_word_length': 3.3398058252427183, 'pattern_counts': {'":': 0, '<': 5, '<?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': '222005', 'n_tokens_mistral': 517, 'n_tokens_neox': 495, 'n_words': 205}