class GHStats::Stats

Public Class Methods

new(username, api = Octokit::Client) click to toggle source
# File lib/ghstats/stats.rb, line 5
def initialize username, api = Octokit::Client
  @api = api
  @username = username
end

Public Instance Methods

most_common_language() click to toggle source
# File lib/ghstats/stats.rb, line 10
def most_common_language
  languages.uniq.max_by{ |l| languages.count(l) }
end

Private Instance Methods

client() click to toggle source
# File lib/ghstats/stats.rb, line 16
def client
  @api.new(auto_paginate: true, per_page: 100)
end
languages() click to toggle source
# File lib/ghstats/stats.rb, line 24
def languages
  @languages ||= repos.map(&:language).compact
end
repos() click to toggle source
# File lib/ghstats/stats.rb, line 20
def repos
  client.repos @username
end