hublingo 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/hublingo.rb +10 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZTU0NTY5YzgyZWRmOTkyYzUxNzY2YzczODdlZjczYjU1ZmQ1Zjk3MA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZjI1MTgyOTc1MzdiYjI0MTgxYWFmOTVhNGRhMTZhNjI5MGMzYjk1NA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTRhMzUwZGUwMGJmNmMzYmI4MzY3NzM2NWE5NTk2ZmFjZDJiNjg2Y2EzZjI5
|
10
|
+
NGViNDQyMDk2OWY4YmFjYmQyM2NmY2NiMDYxZTNhZjFkNzE1OGI0MjQ4NGQ0
|
11
|
+
OWJlMTliYjM2YmE3NGQyMTQ0ODBmNTlmYTQzZGIzNWVjZDc0M2Y=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MGQzNmI2ZjRiMmZjNTMxMjY0ODkwNDhiNzUzN2U2ZmU2Yzg1NTc4MzM0YmQ4
|
14
|
+
ZTA4MDk2ZjRiM2NkYTc5OGIzOTgzNzQzMjRmODVkMWQyM2JiY2FmOGU4Y2Jm
|
15
|
+
MWIxNmFkZTk2ZDI2MzkwMTAxZDc3NGM1OTE1YzQ1MTExMmU3N2M=
|
data/lib/hublingo.rb
CHANGED
@@ -1,19 +1,27 @@
|
|
1
1
|
require 'octokit'
|
2
2
|
|
3
|
+
# @author Dave Goodchild
|
3
4
|
class Hublingo
|
4
5
|
|
5
6
|
attr_accessor :repos
|
6
7
|
attr_accessor :frequencies
|
7
8
|
|
9
|
+
# Constructor initializes repos array and frequencies hash.
|
8
10
|
def initialize
|
9
11
|
@repos = []
|
10
12
|
@frequencies = Hash.new(0)
|
11
13
|
end
|
12
14
|
|
15
|
+
# Returns the size of the repos array.
|
16
|
+
# @return [Fixnum] the size of the array.
|
13
17
|
def size
|
14
18
|
repos.size
|
15
19
|
end
|
16
20
|
|
21
|
+
# Given a Github user name, retrieves all public repos for that.
|
22
|
+
# user and assembles a hash containing language frequency.
|
23
|
+
# @param hacker [String] the Github username
|
24
|
+
# @return [String] error response or favourite language.
|
17
25
|
def lingo(hacker)
|
18
26
|
@repos = Octokit.repos(hacker)
|
19
27
|
languages || "Sorry that hacker has no public repos!"
|
@@ -23,6 +31,8 @@ class Hublingo
|
|
23
31
|
"Uh oh! Rate limit! Please try again at #{Octokit.rate_limit.resets_at}"
|
24
32
|
end
|
25
33
|
|
34
|
+
# Cycles through the repos and builds a hash of language frequencies.
|
35
|
+
# @return [String] of most used language.
|
26
36
|
def languages
|
27
37
|
if repos.any?
|
28
38
|
repos.each do |repo|
|