class CodeRay::Duo

Duo

A Duo is a convenient way to use CodeRay. You just create a Duo, giving it a lang (language of the input code) and a format (desired output format), and call Duo#highlight with the code.

Duo makes it easy to re-use both scanner and encoder for a repetitive task. It also provides a very easy interface syntax:

require 'coderay'
CodeRay::Duo[:python, :div].highlight 'import this'

Until you want to do uncommon things with CodeRay, I recommend to use this method, since it takes care of everything.