Method: CodeRay::Encoders::Encoder#token
- Defined in:
- lib/coderay/encoder.rb
#token(content, kind) ⇒ Object
Called with content
and kind
of the currently scanned token. For simple scanners, it’s enougth to implement this method.
By default, it calls text_token, begin_group, end_group, begin_line, or end_line, depending on the content
.
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/coderay/encoder.rb', line 111 def token content, kind case content when String text_token content, kind when :begin_group begin_group kind when :end_group end_group kind when :begin_line begin_line kind when :end_line end_line kind else raise ArgumentError, 'Unknown token content type: %p, kind = %p' % [content, kind] end end |