Kodama's home / tips.

Lines Of Code(LOC) counter for Ruby

Download: rubyloc.rb.

This script counts semi-physical LOC without comments and empty lines. ";", "then", "else", "end" and some other key words are treated as if line break. The metric is rough but usable.

Usage

$ ruby rubyloc.rb < ruby_script.rb
loc: 379 , def: 59

Kodama's home / tips.