Class: Reporter
- Inherits:
-
Object
- Object
- Reporter
- Defined in:
- lib/reporter.rb
Instance Attribute Summary collapse
-
#commiter_stats ⇒ Object
Returns the value of attribute commiter_stats.
-
#repositories ⇒ Object
readonly
Returns the value of attribute repositories.
-
#repository_stats ⇒ Object
Returns the value of attribute repository_stats.
-
#repository_summaries ⇒ Object
Returns the value of attribute repository_summaries.
-
#work_dir ⇒ Object
Returns the value of attribute work_dir.
Instance Method Summary collapse
- #extract_all_stats(from = Date.new, to = Date.new) ⇒ Object
- #extract_stats(repository_name, from = Date.new, to = Date.new) ⇒ Object
-
#initialize(work_dir, translations) ⇒ Reporter
constructor
A new instance of Reporter.
Constructor Details
#initialize(work_dir, translations) ⇒ Reporter
Returns a new instance of Reporter.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/reporter.rb', line 9 def initialize(work_dir, translations) @work_dir = work_dir @repositories = Hash.new @repository_stats = Hash.new @commiter_stats = Hash.new @repository_summaries = Hash.new @translations = translations discover_repositories initialize_repositories end |
Instance Attribute Details
#commiter_stats ⇒ Object
Returns the value of attribute commiter_stats.
7 8 9 |
# File 'lib/reporter.rb', line 7 def commiter_stats @commiter_stats end |
#repositories ⇒ Object (readonly)
Returns the value of attribute repositories.
6 7 8 |
# File 'lib/reporter.rb', line 6 def repositories @repositories end |
#repository_stats ⇒ Object
Returns the value of attribute repository_stats.
7 8 9 |
# File 'lib/reporter.rb', line 7 def repository_stats @repository_stats end |
#repository_summaries ⇒ Object
Returns the value of attribute repository_summaries.
7 8 9 |
# File 'lib/reporter.rb', line 7 def repository_summaries @repository_summaries end |
#work_dir ⇒ Object
Returns the value of attribute work_dir.
5 6 7 |
# File 'lib/reporter.rb', line 5 def work_dir @work_dir end |
Instance Method Details
#extract_all_stats(from = Date.new, to = Date.new) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/reporter.rb', line 33 def extract_all_stats(from = Date.new, to = Date.new) for repository in @repositories.values yield repository.name if block_given? extract_stats(repository.name, from, to) end end |
#extract_stats(repository_name, from = Date.new, to = Date.new) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/reporter.rb', line 20 def extract_stats(repository_name, from = Date.new, to = Date.new) @repository_stats[repository_name] = Hash.new repository = @repositories[repository_name] repository.pull repository.calculate_stats(from, to) repository.generate_summary(from, to) @repository_summaries[repository_name] = repository.summary for commiter in repository.commiters.keys @repository_stats[repository_name][commiter] = repository.commiters[commiter] end extract_stats_for_commiters(repository_name) end |