Skip to content
Eli Clemente Gordillo Foster edited this page Nov 3, 2015 · 1 revision

All of these methods are called without the need for a GHULS::Lib instance. In other words, they are called simply as:

require 'ghuls/lib'
GHULS::Lib.method_name(parameters)

Methods

configure_stuff

Gets the Octokit and colors for the program.

Arguments

  • opts (Hash) The options to use. The keys taht are used by this method are :token, :pass, and :user

Return

  • (Hash) A hash containing objects formatted as { git: Octokit::Client, colors: JSON }

get_next

Gets the next value in an array.

Arguments

  • single (Any) The current value.
  • full (Array) The main array to parse.

Return

  • Any The next value in the array.

user_exists?

Gets whether or not the user exists.

Arguments

  • username (String) The user to check.
  • github (Octokit::Client) The instance of Octokit to use.

Return

  • Boolean True if the username exists, false if it doesn't.

get_org_repos

Gets the repository's in the user's organizations that they have actually contributed to.

Arguments

  • username (String) See #user_exists?
  • github (Octokit::Client) See #user_exists?

Return

  • Array All the repository full names (org/repo) that the user has contributed to.

get_user_langs

Gets the language and their bytes for the user.

Arguments

  • username (String) The username to get info for.
  • github (Octokit::Client) The instance of Octokit.

Return

  • Hash The languages and their bytes formatted as { Ruby: 129890, CoffeeScript: 5970 }

get_org_langs

calculate_percent

Gets the percentage for the given numbers.

Arguments

  • part (Fixnum) The partial value.
  • whole (Fixnum) The whole value.

Return

  • Fixnum The percentage that part is of whole.

get_color_for_language

Gets the defined color for the language from ozh/github-colors.

Arguments

  • lang (String) The language name.
  • colors (Hash) The hash of colors and languages, obtained from parsing the github-colors JSON.

Return

  • String The 6 digit hexidecimal color. If there is no color defined for the language, returns a random 6 digit hexidecimal color generated by StringUtility.

get_language_percentages

analyze_orgs

analyze_user

get_random_user