Do you need the script to be written in Ruby?
I know there is the
TWAIN interface for scanners, it might suit your needs. Perhaps there are others, though. And I believe I've worked with a scanner which didn't support TWAIN, so it might not be as universal as one would hope..