<commit_before>var get = Ember.get;

DS.Serializer = Ember.Object.extend({
  toJSON: function(record, options) {
    options = options || {};

    var hash = {};

    this.addAttributes(hash, record);

    if (options.includeId) {
      this.addId(hash, record);
    }

    this.addRelationships(hash, record);

    return hash;
  },

  addAttributes: function(hash, record) {
    record.eachAttribute(function(name, attribute) {
      var attributeName = this.attributeName(attribute, record);
      var value = get(record, attribute.name);

      hash[attributeName] = this.transform(value, attribute);
    }, this);
  },

  attributeName: function(attribute, record) {
    return attribute.name;
  },

  transform: function(value, attribute) {
    return value;
  },

  addRelationships: function(hash, record) {
    record.eachAssociation(function(name, relationship) {
      if (relationship.kind === 'belongsTo') {
        this.addBelongsTo(hash, record, relationship);
      } else if (relationship.kind === 'hasMany') {
        this.addHasMany(hash, record, relationship);
      }
    }, this);
  },

  addBelongsTo: function() {

  },

  addHasMany: function() {

  },

  addId: function(hash, record) {
    var primaryKey = this.primaryKey(record);
    hash[primaryKey] = get(record, 'id');
  }
});
<commit_msg>Add warning for unimplemented adapter methods<commit_after>var get = Ember.get;

DS.Serializer = Ember.Object.extend({
  toJSON: function(record, options) {
    options = options || {};

    var hash = {};

    this.addAttributes(hash, record);

    if (options.includeId) {
      this.addId(hash, record);
    }

    this.addRelationships(hash, record);

    return hash;
  },

  addAttributes: function(hash, record) {
    record.eachAttribute(function(name, attribute) {
      var attributeName = this.attributeName(attribute, record);
      var value = get(record, attribute.name);

      hash[attributeName] = this.transform(value, attribute);
    }, this);
  },

  attributeName: function(attribute, record) {
    return attribute.name;
  },

  transform: function(value, attribute) {
    return value;
  },

  addRelationships: function(hash, record) {
    record.eachAssociation(function(name, relationship) {
      if (relationship.kind === 'belongsTo') {
        this.addBelongsTo(hash, record, relationship);
      } else if (relationship.kind === 'hasMany') {
        this.addHasMany(hash, record, relationship);
      }
    }, this);
  },

  addBelongsTo: function() {
    Ember.assert("Serializers must implement addBelongsTo", false);
  },

  addHasMany: function() {
    Ember.assert("Serializers must implement addHasMany", false);
  },

  addId: function(hash, record) {
    var primaryKey = this.primaryKey(record);
    hash[primaryKey] = get(record, 'id');
  }
});

{'fraction_non_alphanumeric': 0.13898788310762653, 'fraction_numerical': 0.0, 'mean_word_length': 3.3996865203761755, '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': '5757806', 'n_tokens_mistral': 871, 'n_tokens_neox': 831, 'n_words': 177}