define('ember-cli-simple-validation/mixins/validate', ['exports', 'ember'], function (exports, Ember) {

    'use strict';

    function attrs(mixin) {
        var attributes = [];
        var factory = mixin.get("constructor.ClassMixin.ownerConstructor");
        factory.eachComputedProperty(function (key) {
            if (key.indexOf("Validation") > 1) {
                attributes.push(key);
            }
        });
        return attributes;
    }

    var ValidationMixin = Ember['default'].Mixin.create({
        validate: function() {
            var self = this;
            var attributes = attrs(this);
            Ember['default'].defineProperty(this, "valid", Ember['default'].computed(function() {
                var result;
                attributes.forEach(function(attr, index) {
                    result = index === 0 ? self.get(attr) : self.get(attr) && result;
                });
                return result;
            }).property("" + attributes));
        }.on("init")
    });

    var validate = function(field, options) {
        return function() {
            var value = this.getWithDefault(field, "");
            if (typeof(options) === "object") {
                return options.test(value);
            }
            return value.trim().length > 0;
        }.property();
    };

    exports.ValidationMixin = ValidationMixin;
    exports.validate = validate;

});