Class: Autoproj::Stats::PackageStats

Inherits:
Object
  • Object
show all
Defined in:
lib/autoproj/stats/package_stats.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sloc = 0, authors = Hash.new, copyright = Hash.new) ⇒ PackageStats

Returns a new instance of PackageStats.



7
8
9
# File 'lib/autoproj/stats/package_stats.rb', line 7

def initialize(sloc = 0, authors = Hash.new, copyright = Hash.new)
    @sloc, @authors, @copyright = sloc, authors, copyright
end

Instance Attribute Details

#authorsObject (readonly)

Returns the value of attribute authors.



5
6
7
# File 'lib/autoproj/stats/package_stats.rb', line 5

def authors
  @authors
end

Returns the value of attribute copyright.



6
7
8
# File 'lib/autoproj/stats/package_stats.rb', line 6

def copyright
  @copyright
end

#slocObject (readonly)

Returns the value of attribute sloc.



4
5
6
# File 'lib/autoproj/stats/package_stats.rb', line 4

def sloc
  @sloc
end

Instance Method Details

#+(other) ⇒ Object



11
12
13
14
15
16
# File 'lib/autoproj/stats/package_stats.rb', line 11

def +(other)
    PackageStats.new(
        sloc + other.sloc,
        authors.merge(other.authors) { |_, v1, v2| v1 + v2 },
        copyright.merge(other.copyright) { |_, v1, v2| v1 + v2 })
end