Class: CodeStats::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/code_stats.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*directories) ⇒ Report

Returns a new instance of Report.


38
39
40
41
# File 'lib/code_stats.rb', line 38

def initialize(*directories)
  @directories = directories
  @lines, @comments, @empty = 0, 0, 0
end

Instance Attribute Details

#commentsObject

Returns the value of attribute comments


36
37
38
# File 'lib/code_stats.rb', line 36

def comments
  @comments
end

#emptyObject

Returns the value of attribute empty


36
37
38
# File 'lib/code_stats.rb', line 36

def empty
  @empty
end

#linesObject

Returns the value of attribute lines


36
37
38
# File 'lib/code_stats.rb', line 36

def lines
  @lines
end

Instance Method Details

#<<(stats) ⇒ Object


43
44
45
46
47
# File 'lib/code_stats.rb', line 43

def <<(stats)
  @lines += stats.lines
  @comments += stats.comments
  @empty += stats.empty
end

#codeObject


49
50
51
# File 'lib/code_stats.rb', line 49

def code
  lines - comments - empty
end