Rupee gains on the back of a softer dollar, foreign fund inflows and buying in domestic equity markets