from the line above the line you show, allow is either true or is a block or is nil. The line you show then checks that (1) allowed is not nil and either (2a) allowed is true or (2b) allowed is a block which returns true when passed resource (and resource must not be nil)
from the line above the line you show,
allowis eithertrueor is ablockor isnil. The line you show then checks that (1)allowedis notniland either (2a)allowedistrueor (2b)allowedis a block which returnstruewhen passedresource(andresourcemust not benil)