Class: GithubAnalyze::Organization
- Inherits:
-
Object
- Object
- GithubAnalyze::Organization
- Defined in:
- lib/github_analyze/organization.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#languages ⇒ Object
readonly
Returns the value of attribute languages.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#repositories ⇒ Object
readonly
Returns the value of attribute repositories.
Instance Method Summary collapse
-
#initialize(name:, client:) ⇒ Organization
constructor
A new instance of Organization.
- #least_common_languages ⇒ Object
- #most_common_languages ⇒ Object
- #ranked_languages ⇒ Object
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
#client ⇒ Object (readonly)
Returns the value of attribute client.
3 4 5 |
# File 'lib/github_analyze/organization.rb', line 3 def client @client end |
#languages ⇒ Object (readonly)
Returns the value of attribute languages.
3 4 5 |
# File 'lib/github_analyze/organization.rb', line 3 def languages @languages end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/github_analyze/organization.rb', line 3 def name @name end |
#repositories ⇒ Object (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_languages ⇒ Object
22 23 24 |
# File 'lib/github_analyze/organization.rb', line 22 def least_common_languages ranked_languages.last(5) end |
#most_common_languages ⇒ Object
18 19 20 |
# File 'lib/github_analyze/organization.rb', line 18 def most_common_languages ranked_languages.first(5) end |
#ranked_languages ⇒ Object
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 |