summaryrefslogtreecommitdiff
path: root/lib/coderay.rb
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2010-06-29 07:11:21 +0000
committermurphy <murphy@rubychan.de>2010-06-29 07:11:21 +0000
commita1330de9438827abcdc331c85dbd7e358b0e118a (patch)
tree7f3fa69a87b529f815525e0a24e85504907d5753 /lib/coderay.rb
parent13a98cec5c7f19e8e7231899645b8f51464becb4 (diff)
downloadcoderay-a1330de9438827abcdc331c85dbd7e358b0e118a.tar.gz
Use autoload instead of require (speeds up CodeRay startup) for CodeRay, Scanner, Tokens, and Encoders::HTML.
Diffstat (limited to 'lib/coderay.rb')
-rw-r--r--lib/coderay.rb28
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/coderay.rb b/lib/coderay.rb
index ad0bb5e..ecd0572 100644
--- a/lib/coderay.rb
+++ b/lib/coderay.rb
@@ -129,12 +129,20 @@ module CodeRay
# Revision: Subversion Revision number (generated on rake gem:make)
VERSION = '1.0.0'
- require 'coderay/tokens'
- require 'coderay/token_kinds'
- require 'coderay/scanner'
- require 'coderay/encoder'
- require 'coderay/duo'
- require 'coderay/style'
+ # Tokens
+ autoload :Tokens, 'coderay/tokens'
+
+ # Plugin system
+ autoload :PluginHost, 'coderay/helpers/plugin'
+ autoload :Plugin, 'coderay/helpers/plugin'
+
+ # Plugins
+ autoload :Scanners, 'coderay/scanner'
+ autoload :Encoders, 'coderay/encoder'
+ autoload :Styles, 'coderay/style'
+
+ # Convenience access / reusable Encoder/Scanner pair
+ autoload :Duo, 'coderay/duo'
class << self
@@ -266,11 +274,3 @@ module CodeRay
end
end
-
-# Run a test script.
-if $0 == __FILE__
- $stderr.print 'Press key to print demo.'; gets
- # Just use this file as an example of Ruby code.
- code = File.read(__FILE__)[/module CodeRay.*/m]
- print CodeRay.scan(code, :ruby).html
-end