summaryrefslogtreecommitdiff
path: root/lib/coderay/encoder.rb
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2011-06-25 18:23:07 +0000
committermurphy <murphy@rubychan.de>2011-06-25 18:23:07 +0000
commit498df2b7654c210c8f47e2757efc33cd94689b57 (patch)
treebda6e10d3eadbf22f1a1a1a2d4e8d0cf7844a3b0 /lib/coderay/encoder.rb
parentd6fe4e777a4f543c8828dbf77e955ab38e6c2803 (diff)
downloadcoderay-498df2b7654c210c8f47e2757efc33cd94689b57.tar.gz
coderay list subcommand and cleanups/fixes in Plugin helper (issue #45)
Diffstat (limited to 'lib/coderay/encoder.rb')
-rw-r--r--lib/coderay/encoder.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/coderay/encoder.rb b/lib/coderay/encoder.rb
index e495ca0..85a2456 100644
--- a/lib/coderay/encoder.rb
+++ b/lib/coderay/encoder.rb
@@ -34,12 +34,17 @@ module CodeRay
# downcase class name instead.
def const_missing sym
if sym == :FILE_EXTENSION
- plugin_id.to_s
+ (@plugin_id || name[/\w+$/].downcase).to_s
else
super
end
end
+ # The default file extension for output file of this encoder class.
+ def file_extension
+ self::FILE_EXTENSION
+ end
+
end
# Subclasses are to store their default options in this constant.
@@ -85,9 +90,9 @@ module CodeRay
# more clear to you.
alias highlight encode
- # Return the default file extension for outputs of this encoder.
+ # The default file extension for this encoder.
def file_extension
- self.class::FILE_EXTENSION
+ self.class.file_extension
end
def << token