code: function(klass) {
          var view = get(this, 'parentView');
          var isOfType = klass instanceof Mixin ?
                         function(view) { return klass.detect(view); } :
                         function(view) { return klass.detect(view.constructor); };
  
          while (view) {
            if (isOfType(view)) { return view; }
            view = get(view, 'parentView');
          }
        }
docs: Return the nearest ancestor that is an instance of the provided
  class or mixin.
  
  @method nearestOfType
  @param {Class,Mixin} klass Subclass of Ember.View (or Ember.View itself),
  or an instance of Ember.Mixin.
  @return Ember.View