Method: CodeRay::Encoders::Encoder#encode

Defined in:
lib/coderay/encoders/encoder.rb

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

Encode the given code using the Scanner for lang.



70
71
72
73
74
75
76
# File 'lib/coderay/encoders/encoder.rb', line 70

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