There is Pygments.rb and there is Linguist, which wraps the former.
Pygments::Lexer['ruby']
Linguist::Language['ruby']
However not all languages and their aliases are supported between the two; Linguist won't find "yml" instead of "yaml", and Pygments doesn't recognize aliases such as "zsh" or "node".