Class: OctoRanker::User

Inherits:
Object
  • Object
show all
Defined in:
lib/octo_ranker/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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( = nil)
  @login, @score = , 0
end

Instance Attribute Details

#login=(value) ⇒ Object (writeonly)

Sets the attribute login

Parameters:

  • value

    the value to set the attribute login to.



4
5
6
# File 'lib/octo_ranker/user.rb', line 4

def login=(value)
  @login = value
end

#scoreObject (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