Class: Hubtime::Repo
- Inherits:
-
Object
- Object
- Hubtime::Repo
- Defined in:
- lib/hubtime/repo.rb
Instance Attribute Summary collapse
-
#cacher ⇒ Object
readonly
Returns the value of attribute cacher.
-
#end_time ⇒ Object
readonly
Returns the value of attribute end_time.
-
#mutex ⇒ Object
readonly
Returns the value of attribute mutex.
-
#repo_name ⇒ Object
readonly
Returns the value of attribute repo_name.
-
#start_time ⇒ Object
readonly
Returns the value of attribute start_time.
-
#thread_count ⇒ Object
readonly
Returns the value of attribute thread_count.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #auto_client ⇒ Object
- #commits(&block) ⇒ Object
-
#initialize(repo_name, username, start_time, end_time) ⇒ Repo
constructor
A new instance of Repo.
- #single_client ⇒ Object
Constructor Details
#initialize(repo_name, username, start_time, end_time) ⇒ Repo
Returns a new instance of Repo.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/hubtime/repo.rb', line 9 def initialize(repo_name, username, start_time, end_time) @repo_name = repo_name @username = username @cacher = Cacher.new("#{repo_name}") @mutex = Mutex.new @thread_count = HubConfig.threads if end_time < start_time @start_time = end_time @end_time = start_time else @start_time = start_time @end_time = end_time end end |
Instance Attribute Details
#cacher ⇒ Object (readonly)
Returns the value of attribute cacher.
7 8 9 |
# File 'lib/hubtime/repo.rb', line 7 def cacher @cacher end |
#end_time ⇒ Object (readonly)
Returns the value of attribute end_time.
8 9 10 |
# File 'lib/hubtime/repo.rb', line 8 def end_time @end_time end |
#mutex ⇒ Object (readonly)
Returns the value of attribute mutex.
7 8 9 |
# File 'lib/hubtime/repo.rb', line 7 def mutex @mutex end |
#repo_name ⇒ Object (readonly)
Returns the value of attribute repo_name.
8 9 10 |
# File 'lib/hubtime/repo.rb', line 8 def repo_name @repo_name end |
#start_time ⇒ Object (readonly)
Returns the value of attribute start_time.
8 9 10 |
# File 'lib/hubtime/repo.rb', line 8 def start_time @start_time end |
#thread_count ⇒ Object (readonly)
Returns the value of attribute thread_count.
7 8 9 |
# File 'lib/hubtime/repo.rb', line 7 def thread_count @thread_count end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
8 9 10 |
# File 'lib/hubtime/repo.rb', line 8 def username @username end |
Instance Method Details
#auto_client ⇒ Object
25 26 27 |
# File 'lib/hubtime/repo.rb', line 25 def auto_client @auto_client ||= Octokit::Client.new(:login => HubConfig.user, :password => HubConfig.password, :auto_traversal => true) end |
#commits(&block) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/hubtime/repo.rb', line 33 def commits(&block) queue = self.sha_list.dup if self.thread_count == 1 work_sha_queue(queue, block) else self.thread_count.times.map { Thread.new do work_sha_queue(queue, block) end }.each(&:join) end end |