Class: GitStats::GitData::Activity

Inherits:
Object
  • Object
show all
Defined in:
lib/git_stats/git_data/activity.rb

Instance Method Summary collapse

Constructor Details

#initialize(commits) ⇒ Activity

Returns a new instance of Activity.



6
7
8
# File 'lib/git_stats/git_data/activity.rb', line 6

def initialize(commits)
  add_commits(commits)
end

Instance Method Details

#by_dateObject



10
11
12
# File 'lib/git_stats/git_data/activity.rb', line 10

def by_date
  @by_date ||= default_hash
end

#by_hourObject



14
15
16
# File 'lib/git_stats/git_data/activity.rb', line 14

def by_hour
  @by_hour ||= default_hash
end

#by_hour_arrayObject



18
19
20
# File 'lib/git_stats/git_data/activity.rb', line 18

def by_hour_array
  by_hour.to_key_indexed_array(min_size: 24, default: 0)
end

#by_monthObject



34
35
36
# File 'lib/git_stats/git_data/activity.rb', line 34

def by_month
  @by_month ||= default_hash
end

#by_month_arrayObject



38
39
40
# File 'lib/git_stats/git_data/activity.rb', line 38

def by_month_array
  by_month.to_key_indexed_array(min_size: 13, default: 0)[1..-1]
end

#by_wdayObject



22
23
24
# File 'lib/git_stats/git_data/activity.rb', line 22

def by_wday
  @by_wday ||= default_hash
end

#by_wday_arrayObject



26
27
28
# File 'lib/git_stats/git_data/activity.rb', line 26

def by_wday_array
  by_wday.to_key_indexed_array(min_size: 7, default: 0)
end

#by_wday_hourObject



30
31
32
# File 'lib/git_stats/git_data/activity.rb', line 30

def by_wday_hour
  @by_wday_hour ||= default_double_hash
end

#by_yearObject



42
43
44
# File 'lib/git_stats/git_data/activity.rb', line 42

def by_year
  @by_year ||= default_hash
end

#by_year_monthObject



46
47
48
# File 'lib/git_stats/git_data/activity.rb', line 46

def by_year_month
  @by_year_month ||= default_double_hash
end