Class: Overtime::OutOfHoursQuery
- Inherits:
-
Object
- Object
- Overtime::OutOfHoursQuery
- Defined in:
- lib/overtime/out_of_hours_query.rb
Instance Method Summary collapse
-
#initialize(repo, options = {}) ⇒ OutOfHoursQuery
constructor
A new instance of OutOfHoursQuery.
- #present ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(repo, options = {}) ⇒ OutOfHoursQuery
Returns a new instance of OutOfHoursQuery.
6 7 8 9 10 11 12 |
# File 'lib/overtime/out_of_hours_query.rb', line 6 def initialize(repo, = {}) @repo = repo @branch = .fetch(:branch, 'master') @count = .fetch(:count, @repo.commit_count) @start = .fetch(:start, 9) @end = .fetch(:end, 18) end |
Instance Method Details
#present ⇒ Object
20 21 22 |
# File 'lib/overtime/out_of_hours_query.rb', line 20 def present run.map { |commit| OutOfHoursPresenter.new(commit, @start, @end) } end |
#run ⇒ Object
14 15 16 17 18 |
# File 'lib/overtime/out_of_hours_query.rb', line 14 def run @repo.commits(@branch, @count).select do |commit| out_of_hours?(commit) end end |