Is `@resource.stat` calling out the the system `stat` syscall? If so we should try not to call it twice in quick succession like this - it can be expensive. Something like this is better:

    stat = @resource.stat()
    is_a_directory = stat && stat.directory?