diff options
author | murphy <murphy@rubychan.de> | 2006-10-17 10:10:35 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2006-10-17 10:10:35 +0000 |
commit | 5e0d6d97bf4676ab1c1ca9b06590dd774d263b0d (patch) | |
tree | db433d0109b087ffaa3f25fece64ea62c7481e8e /sample/load_encoder.rb | |
parent | 975a2fd6ea64529d993bc1412899fad386ff02ea (diff) | |
download | coderay-5e0d6d97bf4676ab1c1ca9b06590dd774d263b0d.tar.gz |
Renamed demo files (trim demo_ prefix).
Diffstat (limited to 'sample/load_encoder.rb')
-rw-r--r-- | sample/load_encoder.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/sample/load_encoder.rb b/sample/load_encoder.rb new file mode 100644 index 0000000..39d310d --- /dev/null +++ b/sample/load_encoder.rb @@ -0,0 +1,25 @@ +require 'coderay'
+
+begin
+ CodeRay::Encoders::YAML
+rescue
+ puts 'CodeRay::Encoders::YAML is not defined; you must load it first.'
+end
+
+yaml_encoder = CodeRay::Encoders[:yaml]
+print 'Now it is loaded: '
+p yaml_encoder
+puts 'See?'
+
+tokens_encoder = require_plugin 'CodeRay::Encoders/tokens'
+print 'Require is also possible: '
+p tokens_encoder
+puts 'See?'
+
+puts 'Now load some mapped encoders: stats and plain.'
+require_plugin 'CodeRay::Encoders/stats'
+require_plugin 'CodeRay::Encoders/plain'
+
+puts 'Require all Encoders:'
+CodeRay::Encoders.load_all
+p CodeRay::Encoders.plugin_hash.sort_by { |k,v| k.to_s }
|