Class: CodeRay::Encoders::Text

Inherits:
Encoder
  • Object
show all
Defined in:
lib/coderay/encoders/text.rb

Overview

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

Constant Summary collapse

FILE_EXTENSION =
'txt'
DEFAULT_OPTIONS =
{
  :separator => nil
}

Instance Attribute Summary

Attributes inherited from Encoder

#options, #scanner

Attributes included from Plugin

#plugin_id

Instance Method Summary collapse

Methods inherited from Encoder

#<<, #begin_group, #begin_line, const_missing, #encode, #encode_tokens, #end_group, #end_line, #file_extension, file_extension, #initialize, #token

Methods included from Plugin

#aliases, #plugin_host, #register_for, #title

Constructor Details

This class inherits a constructor from CodeRay::Encoders::Encoder

Instance Method Details

#text_token(text, kind) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/coderay/encoders/text.rb', line 25

def text_token text, kind
  super
  
  if @first
    @first = false
  else
    @out << @sep
  end if @sep
end