class Ghit::Stats::Contributors
Public Class Methods
get!()
click to toggle source
# File lib/ghit/stats/contributors.rb, line 6 def get! new.get end
new()
click to toggle source
# File lib/ghit/stats/contributors.rb, line 11 def initialize @globals = Ghit::Globals.new @stats = Github::Client::Repos::Statistics.new end
Public Instance Methods
get()
click to toggle source
# File lib/ghit/stats/contributors.rb, line 16 def get contributors = fetch_contributors print_output_heading contributors.each do |c| print_contributor_data c end print_fourty_dashes end
Private Instance Methods
fetch_contributors()
click to toggle source
# File lib/ghit/stats/contributors.rb, line 28 def fetch_contributors @stats.contributors(user: @globals.author, repo: @globals.repository).body end
print_contributor_data(contrib)
click to toggle source
# File lib/ghit/stats/contributors.rb, line 43 def print_contributor_data contrib if contrib.respond_to? :author puts "#{contrib.author.login}\t\t#{contrib.author.html_url}" else puts "#{contrib.login}\t\t#{contrib.html_url}" end end
print_fourty_dashes()
click to toggle source
# File lib/ghit/stats/contributors.rb, line 39 def print_fourty_dashes puts "-" * 40 end
print_output_heading()
click to toggle source
# File lib/ghit/stats/contributors.rb, line 32 def print_output_heading puts "List of contributors to this repository:" print_fourty_dashes puts "Username\t\tProfile URL" print_fourty_dashes end