lib/coderay.rb in coderay-1.0.0.846rc2 vs lib/coderay.rb in coderay-1.0.0.864rc3

- old
+ new

@@ -132,10 +132,11 @@ # helpers autoload :FileType, 'coderay/helpers/file_type' # Tokens autoload :Tokens, 'coderay/tokens' + autoload :TokensProxy, 'coderay/tokens_proxy' autoload :TokenKinds, 'coderay/token_kinds' # Plugin system autoload :PluginHost, 'coderay/helpers/plugin' autoload :Plugin, 'coderay/helpers/plugin' @@ -157,11 +158,11 @@ # page = CodeRay.scan("puts 'Hello, world!'", :ruby).html # # See also demo/demo_simple. def scan code, lang, options = {}, &block # FIXME: return a proxy for direct-stream encoding - scanner(lang, options, &block).tokenize code + TokensProxy.new code, lang, options, block end # Scans +filename+ (a path to a code file) with the Scanner for +lang+. # # If +lang+ is :auto or omitted, the CodeRay::FileType module is used to @@ -174,10 +175,10 @@ # require 'coderay' # page = CodeRay.scan_file('some_c_code.c').html def scan_file filename, lang = :auto, options = {}, &block lang = FileType.fetch filename, :text, true if lang == :auto code = File.read filename - scan code, lang, options = {}, &block + scan code, lang, options, &block end # Encode a string. # # This scans +code+ with the the Scanner for +lang+ and then