A Unified Framework for Modeling Continuum and Rarefied Gas Flows