Source: site.view [edit]
Function name: getClass
Arguments: className
Description: Objects with the fieldname "extends" will be expanded to include fields from inherited objects (hierarchically). Returns nil if the className doesn't exist as a WubHub function, or if one of its inherited parents doesn't exist.
Page type: webl
Render function:  
Module: siteutil

Page source:

var getClass = fun(cName)

   var obj = WubCall(cName, []) ? nil;
   if (obj != nil) and Objectp(obj) then
      var parents = obj.extends ? nil;
      if (parents != nil) then
         if (!Listp(parents)) then
            parents = [ parents ]
         end;

         every parent in parents do
            var obj2 = getClass(parent);
            if (obj2 != nil) and Objectp(obj2) then
               every f in obj2 do
                  if !(f member obj) then
                     obj[f] :=obj2[f]
                  end
               end
            else
               return nil
            end
         end
      end
   end;

   return obj
end;

getClass(className);