Ndef simple channel expansion question

Edit: previous version had a bug. It broke something much more trivial like Ndef(\jc, Ndef(\ar2)) with ERROR: Message 'isUGenClass' not understood. RECEIVER: Instance of Ndef . The reason being that that is treated as if it were an identity math expression. I’ll have to ask on the Dev sub-forum what’s the best way to inquire about classes and instance types in one method, but for now the version below that defines both *isUGenClass and isUGenClass works properly in all cases I could think of.

So, this fixes it for me:

// CombN.isUGen == false while CombN.ar.isUGen == true because isUGen an instance method! So:
+ Object {
	*isUGenClass { ^false }
	isUGenClass { ^false }
}

+ UGen {
	*isUGenClass { ^true }
	isUGenClass { ^false }
}
+ BusPlug {
	value { | something |
		var n;
		if(UGen.buildSynthDef.isNil) { ^this }; // only return when in ugen graph.
		// UGen.numCh always 1, so we let InBus.new1 called by ar/kr auto-detect on nil
		if(something.notNil) { // nil.isUGen == false while nil.isUGenClass --> Error
			if(something.isUGen or: { something.isUGenClass }) {
				//("is UG or UGC" + something + n).postln
			} {
				n = something.numChannels
			}
		};
		//("bpv: " + something + something.isUGen + (something !? { something.isUGenClass }) + n).postln;
		^if(something.respondsTo(\rate) and: { something.rate == 'audio'} or: { this.rate == \audio }) {
			this.ar(n)
		} {
			this.kr(n)
		}

	}
}

/*
-> Ndef('o')
bpv:  nil false nil nil
-> Ndef('f')
bpv:  nil false nil nil
-> Ndef('s')
is UG or UGC CombN nil
bpv:  CombN false true nil
-> Ndef('z')
-> Ndef('z')
-> [ 2, 2, 2, 2 ]
*/