If you don't know exactly what you are doing, you should not use:
sudo apt-get remove package.*
# ⤷ or any other character in the place of dot
as this can delete unintended packages and cause more problems than it solves. The package.* will match all packages (and their dependencies) containing the string package in their name. This is from man apt-get, somewhere at the line 110:
If no package matches the given expression and the expression
contains one of '.', '?' or '*' then it is assumed to be a POSIX
regular expression, and it is applied to all package names in the
database. Any matches are then installed (or removed). Note that
matching is done by substring so 'lo.*' matches 'how-lo' and
'lowest'. If this is undesired, anchor the regular expression with
a '^' or '$' character, or create a more specific regular
expression.
And this is from Regular Expressions/POSIX Basic Regular Expressions Wikibooks:
* Matches the preceding element zero or more times. For example, ab*c matches "ac", "abc", "abbbc", etc. [xyz]* matches "", "x", "y", "z", "zx", "zyx", "xyzzy", and so on. \(ab\)* matches "", "ab", "abab", "ababab", and so on.
Anyway, if you really want to run something like sudo apt-get remove package.* (or sudo apt-get remove packagey*, or sudo apt-get remove packagec* - all are in this case the same), first run it with -s (--simulate) option to see exactly what it will do (see man apt-get for more info).
Now, I think that you can solve your problem using the following two steps:
Reinstall all the packages that you have removed
Remove only ruby:
sudo apt-get remove ruby
Or, if you want to remove all packages starting their names with ruby:
sudo apt-get remove ^ruby
But better to simulate first with:
apt-get -s remove ^ruby