Class: CodeRay::Encoders::Count

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

Overview

Returns the number of tokens.

Text and block tokens are counted.

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 Also known as: end_group, begin_line, end_line



29
30
31
# File 'lib/coderay/encoders/count.rb', line 29

def begin_group kind
  @count += 1
end

#text_token(text, kind) ⇒ Object



25
26
27
# File 'lib/coderay/encoders/count.rb', line 25

def text_token text, kind
  @count += 1
end