Method: CodeRay::Encoders::Encoder#encode

Defined in:
lib/coderay/encoder.rb

#encode(code, lang, options = {}) ⇒ Object Also known as: highlight

Encode the given code using the Scanner for lang.



81
82
83
84
85
86
87
# File 'lib/coderay/encoder.rb', line 81

def encode code, lang, options = {}
  options = @options.merge options
  @scanner = Scanners[lang].new code, CodeRay.get_scanner_options(options).update(:tokens => self)
  setup options
  @scanner.tokenize
  finish options
end