Sha256: 9778d5dddafb4d2252ef5ef5b04572dab4ff7edf54f02fa53e7a8b81e7c60e52

Contents?: true

Size: 737 Bytes

Versions: 6990

Compression:

Stored size: 737 Bytes

Contents

module CodeRay
module Encoders
  
  # Concats the tokens into a single string, resulting in the original
  # code string if no tokens were removed.
  # 
  # Alias: +plain+, +plaintext+
  # 
  # == Options
  # 
  # === :separator
  # A separator string to join the tokens.
  # 
  # Default: empty String
  class Text < Encoder
    
    register_for :text
    
    FILE_EXTENSION = 'txt'
    
    DEFAULT_OPTIONS = {
      :separator => nil
    }
    
    def text_token text, kind
      super
      
      if @first
        @first = false
      else
        @out << @sep
      end if @sep
    end
    
  protected
    def setup options
      super
      
      @first = true
      @sep = options[:separator]
    end
    
  end
  
end
end

Version data entries

6,990 entries across 6,977 versions & 75 rubygems

Version Path
lazy_record-0.2.1 vendor/bundle/gems/coderay-1.1.1/lib/coderay/encoders/text.rb
lazy_record-0.2.0 vendor/bundle/gems/coderay-1.1.1/lib/coderay/encoders/text.rb
lazy_record-0.1.9 vendor/bundle/gems/coderay-1.1.1/lib/coderay/encoders/text.rb
lazy_record-0.1.8 vendor/bundle/gems/coderay-1.1.1/lib/coderay/encoders/text.rb
lazy_record-0.1.7 vendor/bundle/gems/coderay-1.1.1/lib/coderay/encoders/text.rb
lazy_record-0.1.6 vendor/bundle/gems/coderay-1.1.1/lib/coderay/encoders/text.rb
lazy_record-0.1.4 vendor/bundle/gems/coderay-1.1.1/lib/coderay/encoders/text.rb
tdiary-5.0.4 vendor/bundle/gems/coderay-1.1.1/lib/coderay/encoders/text.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/coderay-1.1.1/lib/coderay/encoders/text.rb
logstash-filter-zabbix-0.1.2 vendor/bundle/jruby/1.9/gems/coderay-1.1.1/lib/coderay/encoders/text.rb
lazy_record-0.1.3 vendor/bundle/gems/coderay-1.1.1/lib/coderay/encoders/text.rb
lazy_record-0.1.2 vendor/bundle/gems/coderay-1.1.1/lib/coderay/encoders/text.rb
lazy_record-0.1.1 vendor/bundle/gems/coderay-1.1.1/lib/coderay/encoders/text.rb
lazy_record-0.1.0 vendor/bundle/gems/coderay-1.1.1/lib/coderay/encoders/text.rb
logstash-filter-zabbix-0.1.1 vendor/bundle/jruby/1.9/gems/coderay-1.1.1/lib/coderay/encoders/text.rb
logstash-input-fifo-0.9.1 vendor/bundle/jruby/1.9/gems/coderay-1.1.1/lib/coderay/encoders/text.rb
logstash-input-fifo-0.9.0 vendor/bundle/jruby/1.9/gems/coderay-1.1.1/lib/coderay/encoders/text.rb
logstash-input-salesforce-3.0.0 vendor/jruby/1.9/gems/coderay-1.1.1/lib/coderay/encoders/text.rb
abaci-0.3.0 vendor/bundle/gems/coderay-1.1.1/lib/coderay/encoders/text.rb
ivanvc-logstash-input-s3-3.1.1.4 vendor/local/gems/coderay-1.1.1/lib/coderay/encoders/text.rb