From 498df2b7654c210c8f47e2757efc33cd94689b57 Mon Sep 17 00:00:00 2001 From: murphy Date: Sat, 25 Jun 2011 18:23:07 +0000 Subject: coderay list subcommand and cleanups/fixes in Plugin helper (issue #45) --- lib/coderay/encoder.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib/coderay/encoder.rb') 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 -- cgit v1.2.1