Method: CodeRay::Encoders::Encoder#encode_stream

Defined in:
lib/coderay/encoder.rb

#encode_stream(code, lang, options = {}) ⇒ Object

Encode the given code using the Scanner for lang in streaming mode.

Raises:



97
98
99
100
101
102
103
104
105
# File 'lib/coderay/encoder.rb', line 97

def encode_stream code, lang, options = {}
  raise NotStreamableError, self unless kind_of? Streamable
  options = @options.merge options
  setup options
  scanner_options = CodeRay.get_scanner_options options
  @token_stream =
    CodeRay.scan_stream code, lang, scanner_options, &self
  finish options
end