summaryrefslogtreecommitdiff
path: root/lib/coderay/encoders/lines_of_code.rb
blob: 8ffe9dcf94943817076662e5aeb2b37489d606b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module CodeRay
module Encoders
  
  class LinesOfCode < Encoder
    
    register_for :lines_of_code
    
    def compile tokens, options
      @loc = tokens.token_class_filter(:exclude => [:comment, :doctype]).text.scan(/^\s*\S.*$/).size
    end
    
    def finish options
      @loc
    end
    
  end
  
end
end