<commit_before>module ApiHelper
  def json_records(records = {})
    json_serialized(records.to_a)
  end

  def json_record(record = {})
    json_serialized(record)
  end

  def json_serialized(object = {})
    ActiveModel::SerializableResource.new(object, include: '**').serializable_hash<commit_msg>allow ApiHelper's methods to receive options<commit_after>module ApiHelper
  def json_records(records = {}, options = {})
    json_serialized(records.to_a, options)
  end

  def json_record(record = {}, options = {})
    json_serialized(record, options)
  end

  def json_serialized(object = {}, options = {})
    options.reverse_merge!(include: '**')
    ActiveModel::SerializableResource.new(object, options).serializable_hash
{'fraction_non_alphanumeric': 0.12208504801097393, 'fraction_numerical': 0.0, 'mean_word_length': 5.239316239316239, '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': '4118207', 'n_tokens_mistral': 220, 'n_tokens_neox': 223, 'n_words': 39}