summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2010-01-01 06:10:14 +0000
committermurphy <murphy@rubychan.de>2010-01-01 06:10:14 +0000
commit44fcff8ba9831cede39b02d9fdc866fe5ecf785c (patch)
tree6eb6a8f9192ef6dc969a78f2f1fb0fa6f6722522
parent4b904e78981c8a12a7b53c20b35434f51458b66d (diff)
downloadcoderay-44fcff8ba9831cede39b02d9fdc866fe5ecf785c.tar.gz
New method Scanner#lang.
-rw-r--r--Changes.textile1
-rw-r--r--lib/coderay/scanner.rb5
2 files changed, 6 insertions, 0 deletions
diff --git a/Changes.textile b/Changes.textile
index 92efb28..19b91dd 100644
--- a/Changes.textile
+++ b/Changes.textile
@@ -105,6 +105,7 @@ h3. @Scanners::Scanner@
A list of all token classes not considered in LOC count.
Added appropriate values for scanners.
+* *NEW* method @#lang@ returns the scanner's lang, which is its @plugin_id@.
* *FIXED* automatic, safe UTF-8 detection _[Ruby 1.9]_
* *FIXED* column takes care of multibyte encodings _[Ruby 1.9]_
* *FIXED* is dumpable (@Tokens@ store their scanner in an @@scanner@ variable)
diff --git a/lib/coderay/scanner.rb b/lib/coderay/scanner.rb
index 8233b2c..d6dd19f 100644
--- a/lib/coderay/scanner.rb
+++ b/lib/coderay/scanner.rb
@@ -152,6 +152,11 @@ module CodeRay
alias code string
alias code= string=
+ # Returns the Plugin ID for this scanner.
+ def lang
+ self.class.plugin_id
+ end
+
# Scans the code and returns all tokens in a Tokens object.
def tokenize new_string=nil, options = {}
options = @options.merge(options)