Method: CodeRay.scan

Defined in:
lib/coderay.rb

.scan(code, lang, options = {}, &block) ⇒ Object

Scans the given code (a String) with the Scanner for lang.

This is a simple way to use CodeRay. Example:

require 'coderay'
page = CodeRay.scan("puts 'Hello, world!'", :ruby).html

See also demo/demo_simple.



168
169
170
# File 'lib/coderay.rb', line 168

def scan code, lang, options = {}, &block
  CodeRay::TokensProxy.new code, lang, options, block
end