Hebrew Bible Exegesis:
The book of Joshua, and in particular the battle of Jericho in chapter six, functions as an etiological narrative to explain how Israel gained control of the promised land, with the story of Rahab in chapter two, framed by the greater narrative, as a reminder of the Israelites' identity as a people in covenant with God.
The story of Rahab, when looked at critically and through the lens of literary criticism, functions on one level as an etiological narrative to explain the incorporation of a Canaanite group into Israel, but it also functions as an extended metaphor to remind Israel of its covenant relationship with God.
Contained within the narrative are elements of the suzerain treaty form, as well as allusions to a history of God's mercy in sparing certain righteous individuals from widespread destruction, and Rahab is considered righteous because of her reverence for Yahweh and her assisting of Joshua's spies, seen as critical in fulfilling the story of Israel.
Finally, the most poignant reminder of the covenant is the metaphor functioning as an allusion to the first passover in Egypt. The crimson cord tied to the window in Joshua 2:18, along with the imperative to Rahab to gather her loved ones into the house and stay there until the invasion is complete, is a direct allusion to the blood put onto the doorposts by the Israelites and the imperative to stay indoors in Egypt during the first passover.
My current favorite phrase in grad school is "prehending the orienting Gestalt." Which is fancy way of saying "understanding the underlying whole" with regards to counseling and pastoral care.