diff options
author | murphy <murphy@rubychan.de> | 2009-12-31 02:56:55 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2009-12-31 02:56:55 +0000 |
commit | 46b83c9c5384a299cdc8d8c5381259b1f6d0e4aa (patch) | |
tree | e2930e60c4324f7a17f923ba68c15a6bab5d5576 /lib/coderay/scanner.rb | |
parent | 77fc494cbdbde2719875fb0d7caf2454ef298fca (diff) | |
download | coderay-46b83c9c5384a299cdc8d8c5381259b1f6d0e4aa.tar.gz |
Fixed example tests.
* test:clean task also deletes .expected.html files
* LinesOfCode encoder can deal with tokens that have no scanner.
Tests were added for this.
* JSON encoder load rubygems if necessary.
* NEW :loc as an alias for :lines_of_code
* NEW Scanner methods marshal_dump, marshal_load
FIXED Tokens dumping (failed while trying to dump @scanner)
Diffstat (limited to 'lib/coderay/scanner.rb')
-rw-r--r-- | lib/coderay/scanner.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/coderay/scanner.rb b/lib/coderay/scanner.rb index 229ba19..8233b2c 100644 --- a/lib/coderay/scanner.rb +++ b/lib/coderay/scanner.rb @@ -114,9 +114,10 @@ module CodeRay # # Else, a Tokens object is used. def initialize code='', options = {}, &block - @options = self.class::DEFAULT_OPTIONS.merge options raise "I am only the basic Scanner class. I can't scan "\ "anything. :( Use my subclasses." if self.class == Scanner + + @options = self.class::DEFAULT_OPTIONS.merge options super Scanner.normify(code) @@ -199,6 +200,14 @@ module CodeRay end pos - (string.rindex(?\n, pos) || 0) end + + def marshal_dump + @options + end + + def marshal_load options + @options = options + end protected |