diff options
author | murphy <murphy@rubychan.de> | 2008-12-25 01:22:30 +0000 |
---|---|---|
committer | murphy <murphy@rubychan.de> | 2008-12-25 01:22:30 +0000 |
commit | 79a313948f2277cf0f2e238d5765a71fee03e089 (patch) | |
tree | 7f6c2de879231f1b7a30d9ba481984e79fede9c1 /lib/coderay/encoder.rb | |
parent | bca06f1ec361537c4c7f1368ca8838be2940dafe (diff) | |
download | coderay-79a313948f2277cf0f2e238d5765a71fee03e089.tar.gz |
Fixes for Ruby 1.9.
Diffstat (limited to 'lib/coderay/encoder.rb')
-rw-r--r-- | lib/coderay/encoder.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/coderay/encoder.rb b/lib/coderay/encoder.rb index 28b387b..07733a1 100644 --- a/lib/coderay/encoder.rb +++ b/lib/coderay/encoder.rb @@ -133,7 +133,7 @@ module CodeRay # whether +text+ is a String. def token text, kind out = - if text.is_a? ::String # Ruby 1.9: watch out, :open.is_a? String is true + if text.is_a? ::String text_token text, kind elsif text.is_a? ::Symbol block_token text, kind @@ -171,9 +171,14 @@ module CodeRay # # The already created +tokens+ object must be used; it can be a # TokenStream or a Tokens object. - def compile tokens, options - tokens.each { |text, kind| token text, kind } # FIXME for Ruby 1.9? - #tokens.each(&self) + if RUBY_VERSION >= '1.9' + def compile tokens, options + tokens.each { |text, kind| token text, kind } # FIXME for Ruby 1.9? + end + else + def compile tokens, options + tokens.each(&self) + end end end |