Ruby worked for Sam "Mooney" Giancana, the head of the Outfit in Chicago. Mooney sent him to Dallas way before the assassination to do favors for the police and get in good with them while establishing a useful "presence" there.
Source: Doublecross by Mooney's brother and son (written after Mooney's death). Unfortunately most of my books are in storage so I can't check the dates and am relying on memory here, but I'm sure Ruby was originally sent there just to establish Outfit influence in Dallas. I just can't remember if he was sent there in time to have worked on "helping" the election of JFK--which most people acknowledge the mob did in IL and TX.
My point being that I'm pretty sure the Giancana book did NOT indicate that Ruby was originally sent there for the purpose of killing Oswald, but he sure was there and handy after the mob (including the Outfit) got very, very angry with JFK.