heh, you've got a perfect case for the catch throw block here:

    catch(:url){ gear_groups.each{ |group| group.gears.each{ |gear| throw gear['ssh_url'] if gear['id'] == gear_id } } } or raise ArgumentError, "No SSH URL found for gear #{gear_id}"

Also, I'd raise a separate error if any gear doesn't have the gear ssh_url attribute - because you could have fat fingered the gear id and you'd get an ambiguous error.