Class: CodeRay::Encoders::LinesOfCode

Inherits:
TokenKindFilter show all
Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/coderay-1.1.3/lib/coderay/encoders/lines_of_code.rb

Overview

Counts the LoC (Lines of Code). Returns an Integer >= 0.

Alias: loc

Everything that is not comment, markup, doctype/shebang, or an empty line, is considered to be code.

For example,

  • HTML files not containing JavaScript have 0 LoC

  • in a Java class without comments, LoC is the number of non-empty lines

A Scanner class should define the token kinds that are not code in the KINDS_NOT_LOC constant, which defaults to [:comment, :doctype].

Constant Summary collapse

NON_EMPTY_LINE =
/^\s*\S.*$/

Constants inherited from TokenKindFilter

TokenKindFilter::DEFAULT_OPTIONS

Constants inherited from Encoder

Encoder::DEFAULT_OPTIONS

Instance Attribute Summary

Attributes inherited from Encoder

#options, #scanner

Attributes included from Plugin

#plugin_id

Method Summary

Methods inherited from TokenKindFilter

#begin_group, #begin_line, #end_group, #end_line, #text_token

Methods inherited from Filter

#begin_group, #begin_line, #end_group, #end_line, #text_token

Methods inherited from Encoder

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

Methods included from Plugin

#aliases, #plugin_host, #register_for, #title

Constructor Details

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