Man wards off attempted robbery