class CodeRay::Encoders::LinesOfCode
KINDS_NOT_LOC constant, which defaults to [:comment, :doctype].
A Scanner class should define the token kinds that are not code in the
* in a Java class without comments, LoC is the number of non-empty lines
* HTML files not containing JavaScript have 0 LoC
For example,
is considered to be code.
Everything that is not comment, markup, doctype/shebang, or an empty line,
Alias: loc
Counts the LoC (Lines of Code). Returns an Integer >= 0.
def finish options
def finish options output @tokens.text.scan(NON_EMPTY_LINE).size end
def setup options
def setup options if scanner kinds_not_loc = scanner.class::KINDS_NOT_LOC else warn "Tokens have no associated scanner, counting all nonempty lines." if $VERBOSE kinds_not_loc = CodeRay::Scanners::Scanner::KINDS_NOT_LOC end options[:exclude] = kinds_not_loc super options end