Class: CodeRay::Encoders::Filter

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

Overview

A Filter encoder has another Tokens instance as output. It can be subclass to select, remove, or modify tokens in the stream.

Subclasses of Filter are called “Filters” and can be chained.

Options

:tokens

The Tokens object which will receive the output.

Default: Tokens.new

See also: TokenKindFilter

Direct Known Subclasses

TokenKindFilter

Constant Summary

Constants inherited from Encoder

Encoder::DEFAULT_OPTIONS

Instance Attribute Summary

Attributes inherited from Encoder

#options, #scanner

Attributes included from Plugin

#plugin_id

Instance Method Summary collapse

Methods inherited from Encoder

#<<, const_missing, #encode, #encode_tokens, 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

#begin_group(kind) ⇒ Object

:nodoc:



39
40
41
# File 'lib/coderay/encoders/filter.rb', line 39

def begin_group kind  # :nodoc:
  @tokens.begin_group kind
end

#begin_line(kind) ⇒ Object

:nodoc:



43
44
45
# File 'lib/coderay/encoders/filter.rb', line 43

def begin_line kind  # :nodoc:
  @tokens.begin_line kind
end

#end_group(kind) ⇒ Object

:nodoc:



47
48
49
# File 'lib/coderay/encoders/filter.rb', line 47

def end_group kind  # :nodoc:
  @tokens.end_group kind
end

#end_line(kind) ⇒ Object

:nodoc:



51
52
53
# File 'lib/coderay/encoders/filter.rb', line 51

def end_line kind  # :nodoc:
  @tokens.end_line kind
end

#text_token(text, kind) ⇒ Object

:nodoc:



35
36
37
# File 'lib/coderay/encoders/filter.rb', line 35

def text_token text, kind  # :nodoc:
  @tokens.text_token text, kind
end