MCPcopy Create free account
hub / github.com/dagger/dagger / buildClass

Method buildClass

sdk/typescript/src/module/executor.ts:38–57  ·  view source on GitHub ↗
(object: string, state: State)

Source from the content-addressed store, hash-verified

36 }
37
38 buildClass(object: string, state: State): any {
39 const daggerObject = this.daggerModule.objects[object]
40 if (!daggerObject) {
41 throw new FunctionNotFound(`Object ${object} not found in the module`)
42 }
43
44 switch (daggerObject.kind()) {
45 case "class": {
46 const obj = this.getExportedObject(object)
47
48 const instanciatedClass = Object.create(obj.prototype)
49 Object.assign(instanciatedClass, state)
50
51 return instanciatedClass
52 }
53 case "object": {
54 return state
55 }
56 }
57 }
58
59 /**
60 * Transform a Dagger interface identifier into an implementation of this

Callers 2

getResultMethod · 0.95
loadValueFunction · 0.45

Calls 3

getExportedObjectMethod · 0.95
kindMethod · 0.65
createMethod · 0.45

Tested by

no test coverage detected