Class: FileTypeFileStats

Inherits:
Object
  • Object
show all
Includes:
StatsHash
Defined in:
lib/gitstats/stats/file/filetype.rb

Instance Method Summary collapse

Methods included from StatsHash

#each_sorted, #method_missing

Constructor Details

#initializeFileTypeFileStats

Returns a new instance of FileTypeFileStats.



4
5
6
# File 'lib/gitstats/stats/file/filetype.rb', line 4

def initialize
  @hash = Hash.new
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class StatsHash

Instance Method Details

#update(file) ⇒ Object



8
9
10
11
12
# File 'lib/gitstats/stats/file/filetype.rb', line 8

def update(file)
  type = File.extname(file[:name])
  @hash[type] ||= FileStats.new
  @hash[type].update(file)
end