Class: Balboa::PunchDate

Inherits:
Object
  • Object
show all
Defined in:
lib/balboa/punch_date.rb

Instance Method Summary collapse

Constructor Details

#initialize(date, cli) ⇒ PunchDate

Returns a new instance of PunchDate.



7
8
9
10
11
# File 'lib/balboa/punch_date.rb', line 7

def initialize(date, cli)
  @date = date
  @cli = cli
  @holiday = Hash(Holidays.on(date, :br).first)
end

Instance Method Details

#punchable?Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
19
20
21
# File 'lib/balboa/punch_date.rb', line 13

def punchable?
  if weekend?
    false
  elsif holiday?
    ask_for_punch
  else
    true
  end
end

#strftime(format) ⇒ Object



27
28
29
# File 'lib/balboa/punch_date.rb', line 27

def strftime(format)
  @date.strftime(format)
end

#to_sObject



23
24
25
# File 'lib/balboa/punch_date.rb', line 23

def to_s
  @date.to_s
end