Class: OctoRanker::User
- Inherits:
-
Object
- Object
- OctoRanker::User
- Defined in:
- lib/octo_ranker/user.rb
Instance Attribute Summary collapse
-
#login ⇒ Object
writeonly
Sets the attribute login.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
Instance Method Summary collapse
-
#add_repo(commits, repo) ⇒ Object
Add the score for
repo
to the score for this user. -
#initialize(login = nil) ⇒ User
constructor
A new instance of User.
Constructor Details
#initialize(login = nil) ⇒ User
Returns a new instance of User.
6 7 8 |
# File 'lib/octo_ranker/user.rb', line 6 def initialize(login = nil) @login, @score = login, 0 end |
Instance Attribute Details
#login=(value) ⇒ Object (writeonly)
Sets the attribute login
4 5 6 |
# File 'lib/octo_ranker/user.rb', line 4 def login=(value) @login = value end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
3 4 5 |
# File 'lib/octo_ranker/user.rb', line 3 def score @score end |
Instance Method Details
#add_repo(commits, repo) ⇒ Object
Add the score for repo
to the score for this user. Currently, the score for a repo is defined as the product of the number of commits the user has on the repo and the weight of that repo. See OctoRanker::Repository for how the weight is defined.
15 16 17 |
# File 'lib/octo_ranker/user.rb', line 15 def add_repo(commits, repo) @score += commits * repo.weight end |