summaryrefslogtreecommitdiff
path: root/lib/coderay/tokens.rb
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2011-09-19 01:47:08 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2011-09-19 01:47:08 +0200
commit2f97912d6372b3edde924f83ed283b97f6472273 (patch)
treede7cb89c4f44e03f280ef831295a33339e4d31e8 /lib/coderay/tokens.rb
parent14b4728342af152f865f29e67d583c733e912756 (diff)
downloadcoderay-2f97912d6372b3edde924f83ed283b97f6472273.tar.gz
TokensProxy: wrap up
Diffstat (limited to 'lib/coderay/tokens.rb')
-rw-r--r--lib/coderay/tokens.rb13
1 files changed, 2 insertions, 11 deletions
diff --git a/lib/coderay/tokens.rb b/lib/coderay/tokens.rb
index b357199..ee28a4e 100644
--- a/lib/coderay/tokens.rb
+++ b/lib/coderay/tokens.rb
@@ -64,12 +64,7 @@ module CodeRay
#
# options are passed to the encoder.
def encode encoder, options = {}
- unless encoder.is_a? Encoders::Encoder
- if encoder.respond_to? :to_sym
- encoder_class = Encoders[encoder]
- end
- encoder = encoder_class.new options
- end
+ encoder = Encoders[encoder].new options if encoder.respond_to? :to_sym
encoder.encode_tokens self, options
end
@@ -83,15 +78,11 @@ module CodeRay
# For example, if you call +tokens.html+, the HTML encoder
# is used to highlight the tokens.
def method_missing meth, options = {}
- encode_with meth, options
+ encode meth, options
rescue PluginHost::PluginNotFound
super
end
- def encode_with encoder, options = {}
- Encoders[encoder].new(options).encode_tokens self
- end
-
# Returns the tokens compressed by joining consecutive
# tokens of the same kind.
#