Class: GithubAnalyze::Organization

Inherits:
Object
  • Object
show all
Defined in:
lib/github_analyze/organization.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, client:) ⇒ Organization

Returns a new instance of Organization.



5
6
7
8
9
10
11
12
# File 'lib/github_analyze/organization.rb', line 5

def initialize(name:, client:)
  @name = name
  @client = client
  @languages = Hash.new(0)
  @repositories = []

  process!
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



3
4
5
# File 'lib/github_analyze/organization.rb', line 3

def client
  @client
end

#languagesObject (readonly)

Returns the value of attribute languages.



3
4
5
# File 'lib/github_analyze/organization.rb', line 3

def languages
  @languages
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/github_analyze/organization.rb', line 3

def name
  @name
end

#repositoriesObject (readonly)

Returns the value of attribute repositories.



3
4
5
# File 'lib/github_analyze/organization.rb', line 3

def repositories
  @repositories
end

Instance Method Details

#least_common_languagesObject



22
23
24
# File 'lib/github_analyze/organization.rb', line 22

def least_common_languages
  ranked_languages.last(5)
end

#most_common_languagesObject



18
19
20
# File 'lib/github_analyze/organization.rb', line 18

def most_common_languages
  ranked_languages.first(5)
end

#ranked_languagesObject



14
15
16
# File 'lib/github_analyze/organization.rb', line 14

def ranked_languages
  languages.sort_by { |k, v| [-v, k] }.map { |k, v| k }
end