summaryrefslogtreecommitdiffstats
path: root/vendor/plugins/coderay-0.7.6.227/lib/coderay/encoders/text.rb
blob: 14282ac5f2d0371f1507de8901ce64ae9a7d7848 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
module CodeRay
module Encoders

  class Text < Encoder

    include Streamable
    register_for :text

    FILE_EXTENSION = 'txt'

    DEFAULT_OPTIONS = {
      :separator => ''
    }

  protected
    def setup options
      @out = ''
      @sep = options[:separator]
    end

    def token text, kind
      @out << text + @sep if text.is_a? ::String
    end

    def finish options
      @out.chomp @sep
    end

  end

end
end