Class: Babygitter::RepoAnalyzer::Author
- Inherits:
-
Object
- Object
- Babygitter::RepoAnalyzer::Author
- Includes:
- DateTimeArrays
- Defined in:
- lib/babygitter/repo_analyzer/author.rb
Overview
An Author contains the basic informtion for an author of a Branch in a git repository
Instance Attribute Summary collapse
-
#began ⇒ Object
Returns the value of attribute began.
-
#commits ⇒ Object
Returns the value of attribute commits.
-
#latest_commit ⇒ Object
Returns the value of attribute latest_commit.
-
#name ⇒ Object
Returns the value of attribute name.
-
#total_committed ⇒ Object
Returns the value of attribute total_committed.
Instance Method Summary collapse
-
#create_bar_data_points ⇒ Object
Inserts the commits into the correct array for use in gruff graph * creates the variable week_map through the method create_52_week_map * creates an array of 52 zeros * using the index of where the commit can be found in week map it adds 1 to number found in at that index in plot_array TODO put this in it’s own module?.
-
#initialize(commits) ⇒ Author
constructor
A new instance of Author.
- #inspect ⇒ Object
Methods included from DateTimeArrays
#create_52_week_map, #create_active_date_array
Constructor Details
#initialize(commits) ⇒ Author
Returns a new instance of Author.
10 11 12 13 14 15 16 |
# File 'lib/babygitter/repo_analyzer/author.rb', line 10 def initialize(commits) @name = commits.first..name @commits = commits @total_committed = commits.size @began = commits.last @latest_commit = commits.first end |
Instance Attribute Details
#began ⇒ Object
Returns the value of attribute began.
8 9 10 |
# File 'lib/babygitter/repo_analyzer/author.rb', line 8 def began @began end |
#commits ⇒ Object
Returns the value of attribute commits.
8 9 10 |
# File 'lib/babygitter/repo_analyzer/author.rb', line 8 def commits @commits end |
#latest_commit ⇒ Object
Returns the value of attribute latest_commit.
8 9 10 |
# File 'lib/babygitter/repo_analyzer/author.rb', line 8 def latest_commit @latest_commit end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/babygitter/repo_analyzer/author.rb', line 8 def name @name end |
#total_committed ⇒ Object
Returns the value of attribute total_committed.
8 9 10 |
# File 'lib/babygitter/repo_analyzer/author.rb', line 8 def total_committed @total_committed end |
Instance Method Details
#create_bar_data_points ⇒ Object
Inserts the commits into the correct array for use in gruff graph
-
creates the variable week_map through the method create_52_week_map
-
creates an array of 52 zeros
-
using the index of where the commit can be found in week map it adds 1 to number found in at that index in plot_array
TODO put this in it’s own module?
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/babygitter/repo_analyzer/author.rb', line 23 def week_map = create_52_week_map points_array = Array.new(52, 0) for commit in @commits unless week_map.index(commit.date.strftime("%U %Y")) == nil index = week_map.index(commit.date.strftime("%U %Y")) points_array[index] +=1 end end points_array end |
#inspect ⇒ Object
35 36 37 |
# File 'lib/babygitter/repo_analyzer/author.rb', line 35 def inspect %Q{#<Babygitter::Author #{@name}>} end |