text.rb
32 lines
| 400 B
| text/x-ruby
|
RubyLexer
|
r638 | module CodeRay | ||
module Encoders | ||||
class Text < Encoder | ||||
include Streamable | ||||
register_for :text | ||||
FILE_EXTENSION = 'txt' | ||||
DEFAULT_OPTIONS = { | ||||
:separator => '' | ||||
} | ||||
protected | ||||
def setup options | ||||
|
r3478 | super | ||
|
r638 | @sep = options[:separator] | ||
end | ||||
|
r3478 | def text_token text, kind | ||
text + @sep | ||||
|
r638 | end | ||
def finish options | ||||
|
r3478 | super.chomp @sep | ||
|
r638 | end | ||
end | ||||
end | ||||
end | ||||