class CodeRay::Duo
def initialize lang = nil, format = nil, options = {}
The options are forwarded to scanner and encoder
CodeRay::Duo[{ :ruby => :statistic }, :do => :something].encode 'abc'
alternative syntax with options:
CodeRay::Duo[:ruby => :statistic].encode 'class << self; end'
alternative syntax without options:
CodeRay::Duo[:ruby, :html, :hint => :debug].highlight '????::??'
with options:
CodeRay::Duo[:ruby, :html].highlight 'bla 42'
simple:
Create a new Duo, holding a lang and a format to highlight code.
def initialize lang = nil, format = nil, options = {} if format.nil? && lang.is_a?(Hash) && lang.size == 1 @lang = lang.keys.first @format = lang[@lang] else @lang = lang @format = format end @options = options end