diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2016-02-13 17:14:48 +0100 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2016-02-13 17:14:48 +0100 |
commit | 5cc8c52f7ca0dc31eb85d065579d66dd0f0cd540 (patch) | |
tree | 47682e4141e1c52d888281cb3dd9a6a57f6e0513 /lib/coderay.rb | |
parent | 0ad3ddc26da51b3bdd0454859f894761a0155c1b (diff) | |
parent | 12a467ca21faad604655d5f2e7b87b42d7a30b4a (diff) | |
download | coderay-5cc8c52f7ca0dc31eb85d065579d66dd0f0cd540.tar.gz |
Merge pull request #190 from rubychan/autoload
Cleanup Folder structure
Diffstat (limited to 'lib/coderay.rb')
-rw-r--r-- | lib/coderay.rb | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/coderay.rb b/lib/coderay.rb index f759ed6..c3de20b 100644 --- a/lib/coderay.rb +++ b/lib/coderay.rb @@ -134,7 +134,7 @@ module CodeRay File.join CODERAY_PATH, *path end - require 'coderay/version' + autoload :VERSION, 'coderay/version' # helpers autoload :FileType, coderay_path('helpers', 'file_type') @@ -145,13 +145,13 @@ module CodeRay autoload :TokenKinds, coderay_path('token_kinds') # Plugin system - autoload :PluginHost, coderay_path('helpers', 'plugin') + autoload :PluginHost, coderay_path('helpers', 'plugin_host') autoload :Plugin, coderay_path('helpers', 'plugin') # Plugins - autoload :Scanners, coderay_path('scanner') - autoload :Encoders, coderay_path('encoder') - autoload :Styles, coderay_path('style') + autoload :Scanners, coderay_path('scanners') + autoload :Encoders, coderay_path('encoders') + autoload :Styles, coderay_path('styles') # convenience access and reusable Encoder/Scanner pair autoload :Duo, coderay_path('duo') @@ -166,7 +166,7 @@ module CodeRay # # See also demo/demo_simple. def scan code, lang, options = {}, &block - TokensProxy.new code, lang, options, block + CodeRay::TokensProxy.new code, lang, options, block end # Scans +filename+ (a path to a code file) with the Scanner for +lang+. @@ -181,7 +181,7 @@ module CodeRay # 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 + lang = CodeRay::FileType.fetch filename, :text, true if lang == :auto code = File.read filename scan code, lang, options, &block end @@ -258,7 +258,7 @@ module CodeRay # ] # #-> 2 out of 4 tokens have the kind :integer. def encoder format, options = {} - Encoders[format].new options + CodeRay::Encoders[format].new options end # Finds the Scanner class for +lang+ and creates an instance, passing @@ -266,7 +266,7 @@ module CodeRay # # See Scanner.new. def scanner lang, options = {}, &block - Scanners[lang].new '', options, &block + CodeRay::Scanners[lang].new '', options, &block end # Extract the options for the scanner from the +options+ hash. |