diff options
author | murphy <murphy@rubychan.de> | 2005-11-05 14:37:40 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2005-11-05 14:37:40 +0000 |
commit | a05a7d11b1bc08f3817076dcb669bc6ef9d6d264 (patch) | |
tree | 27a0e78fcc2a8c0a6adb67c5a3b7b37047f226e4 /lib/coderay | |
parent | 4c01ff6ef9761ac4eb479dfc0d5ee3d25e9a2bc2 (diff) | |
download | coderay-a05a7d11b1bc08f3817076dcb669bc6ef9d6d264.tar.gz |
bench/bench.rb: Added SilverCity benchmarking
demo/demo_load_encoder.rb enhanced
demo/demo_load_scanner.rb added
.outs added
plugin.rb: Fixed load_all
encoder.rb, scanner.rb adjusted
helpers/word_list.rb: Fixed a bug in CaseIgnoringWordList.new
TODO: Updated
new ROADMAP
coderay.rb: increased Version number
added Version System documentation
Diffstat (limited to 'lib/coderay')
-rw-r--r-- | lib/coderay/encoder.rb | 2 | ||||
-rw-r--r-- | lib/coderay/helpers/plugin.rb | 11 | ||||
-rw-r--r-- | lib/coderay/helpers/word_list.rb | 5 | ||||
-rw-r--r-- | lib/coderay/scanner.rb | 2 |
4 files changed, 15 insertions, 5 deletions
diff --git a/lib/coderay/encoder.rb b/lib/coderay/encoder.rb index 362cfb4..8b6c22a 100644 --- a/lib/coderay/encoder.rb +++ b/lib/coderay/encoder.rb @@ -9,7 +9,7 @@ module CodeRay # belonging to the given format.
module Encoders
extend PluginHost
- plugin_path 'coderay/encoders'
+ plugin_path File.dirname(__FILE__), 'encoders'
# = Encoder
#
diff --git a/lib/coderay/helpers/plugin.rb b/lib/coderay/helpers/plugin.rb index 5c90901..63c3739 100644 --- a/lib/coderay/helpers/plugin.rb +++ b/lib/coderay/helpers/plugin.rb @@ -105,10 +105,19 @@ module PluginHost end
end
+ # A Hash of plugion_id => Plugin pairs.
def plugin_hash
@plugin_hash ||= create_plugin_hash
end
+ def inspect
+ map = plugin_hash.dup
+ map.each do |id, plugin|
+ map[id] = plugin.name[/(?>[\w_]+)$/]
+ end
+ map.inspect
+ end
+
# Every plugin must register itself for one or more
# +ids+ by calling register_for, which calls this method.
@@ -137,7 +146,7 @@ module PluginHost # Loads all plugins using all_plugin_names and load.
def load_all
for plugin in all_plugin_names
- load_plugin plugin
+ load plugin
end
end
diff --git a/lib/coderay/helpers/word_list.rb b/lib/coderay/helpers/word_list.rb index 1371446..be81fd0 100644 --- a/lib/coderay/helpers/word_list.rb +++ b/lib/coderay/helpers/word_list.rb @@ -78,10 +78,11 @@ module CodeRay # Creates a new WordList with +default+ as default value.
#
# Text case is ignored.
- def initialize default = false
- super() do |h, k|
+ def initialize default = false, &block
+ block ||= proc do |h, k|
h[k] = h.fetch k.downcase, default
end
+ super default
end
# Checks if a word is included.
diff --git a/lib/coderay/scanner.rb b/lib/coderay/scanner.rb index 609f4da..33bcb09 100644 --- a/lib/coderay/scanner.rb +++ b/lib/coderay/scanner.rb @@ -17,7 +17,7 @@ module CodeRay # See PluginHost.
module Scanners
extend PluginHost
- plugin_path 'coderay/scanners'
+ plugin_path File.dirname(__FILE__), 'scanners'
require 'strscan'
|