Can you "if" on resource_class?

All,

I was wondering if there is a way in the YAML to “if” the resource_class of an executor? I ask because I’d like to always do, say:

make -j$(nproc) install

but it turns out if I do that on a medium resource class, it falls apart (due to memory limits, I think), so I have to do:

make -j4 install

but on a large or higher, it seems okay. So I was wondering if there is anyway to do an if-test on the resource class so that if we had to change/reduce from large to medium the number of jobs my make does?