<commit_before>import Ember from "ember";
import humanize from "ember-form-builder/utilities/humanize";
import guessType from "ember-form-builder/utilities/guess-type";

const extension = {
  i18n: Ember.inject.service(),
  // TODO: assertions
  class: null,
  classNameBindings: ["wrapperClassName", "wrapperTypeClassName"],
  hasFocusedOut: false,
  as: Ember.computed("_model", "attr", function() {
    return guessType(this.get("_model"), this.get("attr"), this);
  }),
  attr: null,
  configuration: {},

  type: Ember.computed.alias("as"),
  object: Ember.computed.alias("builder.object"),
  _model: Ember.computed.alias("builder.model"),
  modelName: Ember.computed.alias("builder.modelName"),
  builder: Ember.computed({
    set(key, value) {
      if (value && value.builder) {
        return value.builder;
      } else {
        return value;
      }
    }
  }),

  init: function() {
    this._super();

    this.objectOrAttrChanged();
  },

  focusOut: function() {
    this.set("hasFocusedOut", true);
  },

  setupClassNameBindings: Ember.on("init", function() {
    this.classNameBindings.push("hasErrors:" + this.get("configuration.wrapperWithErrorsClass"));
    this.classNameBindings.push("hasUnit:" + this.get("configuration.wrapperWithUnitClass"));
  }),

  validations: Ember.computed("model", "attr", function() {
    return this.get("object.validations." + this.get("attr"));
  }),

  isRequired: Ember.computed("validations.presence", function() {
    var presenceValidator = this.get("validations.presence");
    return presenceValidator && !presenceValidator.soft;
  }),

  hasErrors: Ember.computed("hasFocusedOut", "builder.isValid", "errors", function() {
    return (this.get("hasFocusedOut") || !this.get("builder.isValid")) && !Ember.isEmpty(this.get("errors"));
  }),
<commit_msg>Fixed classNameBindings error on Ember 2.11<commit_after>import Ember from "ember";
import humanize from "ember-form-builder/utilities/humanize";
import guessType from "ember-form-builder/utilities/guess-type";

const extension = {
  i18n: Ember.inject.service(),
  // TODO: assertions
  class: null,
  classNameBindings: ["wrapperClassName", "wrapperTypeClassName"],
  hasFocusedOut: false,
  as: Ember.computed("_model", "attr", function() {
    return guessType(this.get("_model"), this.get("attr"), this);
  }),
  attr: null,
  configuration: {},

  type: Ember.computed.alias("as"),
  object: Ember.computed.alias("builder.object"),
  _model: Ember.computed.alias("builder.model"),
  modelName: Ember.computed.alias("builder.modelName"),
  builder: Ember.computed({
    set(key, value) {
      if (value && value.builder) {
        return value.builder;
      } else {
        return value;
      }
    }
  }),

  init: function() {
    this._super();

    this.objectOrAttrChanged();
  },

  focusOut: function() {
    this.set("hasFocusedOut", true);
  },

  setupClassNameBindings: Ember.on("init", function() {
    let newBindings = [
      "hasErrors:" + this.get("configuration.wrapperWithErrorsClass"),
      "hasUnit:" + this.get("configuration.wrapperWithUnitClass")
    ];
    let combinedBindings = (this.get("classNameBindings") || []).concat(newBindings);
    this.set("classNameBindings", combinedBindings);
  }),

  validations: Ember.computed("model", "attr", function() {
    return this.get("object.validations." + this.get("attr"));
  }),

  isRequired: Ember.computed("validations.presence", function() {
    var presenceValidator = this.get("validations.presence");
    return presenceValidator && !presenceValidator.soft;
  }),

  hasErrors: Ember.computed("hasFocusedOut", "builder.isValid", "errors", function() {
    return (this.get("hasFocusedOut") || !this.get("builder.isValid")) && !Ember.isEmpty(this.get("errors"));
  }),

{'fraction_non_alphanumeric': 0.1698913331566393, 'fraction_numerical': 0.0018552875695732839, 'mean_word_length': 4.353191489361702, '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': '4716687', 'n_tokens_mistral': 1193, 'n_tokens_neox': 1174, 'n_words': 205}