Class: Overtime::OutOfHoursPresenter

Inherits:
Object
  • Object
show all
Defined in:
lib/overtime/out_of_hours_presenter.rb

Instance Method Summary collapse

Constructor Details

#initialize(commit, start, finish) ⇒ OutOfHoursPresenter

Returns a new instance of OutOfHoursPresenter.



4
5
6
7
8
# File 'lib/overtime/out_of_hours_presenter.rb', line 4

def initialize(commit, start, finish)
  @commit = commit
  @start = start
  @finish = finish
end

Instance Method Details

#to_sObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/overtime/out_of_hours_presenter.rb', line 10

def to_s
  if weekend?
    "This commit -#{@commit.id_abbrev}- by #{@commit.author} took place at the weekend"
  elsif before_start?
    "This commit -#{@commit.id_abbrev}- by #{@commit.author} took place before 9am at #{@commit.authored_date}"
  elsif after_finish?
    "This commit -#{@commit.id_abbrev}- by #{@commit.author} took place after 6pm at #{@commit.authored_date}"
  else
    "This commit -#{@commit.id_abbrev}- is OK at #{@commit.authored_date}"
  end
end