Class | Ohcount::Loc
In: | lib/ohcount/loc.rb
Parent: | Object

Tracks total lines of code, comments, and blanks for a single language

### Methods

+ new total

### Attributes

blanks | [RW] |
code | [RW] |
comments | [RW] |
filecount | [RW] |
language | [RW] |

### Public Class methods

new(language, params={})

[Source]

    # File lib/ohcount/loc.rb, line 6
                    def initialize(language, params={})
                            raise ArgumentError.new("language can't be nil") unless language
                            @language = language
                            @code = @comments = @blanks = @filecount = 0
                            params.each { |k,v| send(k.to_s + '=', v) if respond_to?(k.to_s + '=') }
                    end

### Public Instance methods

+(addend)

[Source]

    # File lib/ohcount/loc.rb, line 17
                    def +(addend)
                            raise ArgumentError.new("Cannot add language '#{addend.language}' to language '#{language}'") unless addend.language == language
                            @code += addend.code
                            @comments += addend.comments
                            @blanks += addend.blanks
                            @filecount += addend.filecount
                            self
                    end

total()

[Source]

    # File lib/ohcount/loc.rb, line 13
                    def total
                            @code + @comments + @blanks
                    end

[Validate]