code: function const_lookup_ancestors(cref, name) {
      var i, ii, result, ancestors;
  
      if (cref == null) return;
  
      ancestors = Opal.ancestors(cref);
  
      for (i = 0, ii = ancestors.length; i < ii; i++) {
        if (ancestors[i].$$const && $hasOwn.call(ancestors[i].$$const, name)) {
          return ancestors[i].$$const[name];
        }
      }
    }
docs: Walk up the ancestors chain looking for the constant