Class: Balboa::CLI::Command::PunchCommand::PunchDate

Inherits:
Object
  • Object
show all
Defined in:
lib/balboa/cli/command/punch_command.rb

Instance Method Summary collapse

Constructor Details

#initialize(date) ⇒ PunchDate

Returns a new instance of PunchDate.



45
46
47
48
# File 'lib/balboa/cli/command/punch_command.rb', line 45

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

Instance Method Details

#punchable?Boolean

Returns:

  • (Boolean)


50
51
52
53
54
55
56
57
58
# File 'lib/balboa/cli/command/punch_command.rb', line 50

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

#strftime(format) ⇒ Object



64
65
66
# File 'lib/balboa/cli/command/punch_command.rb', line 64

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

#to_sObject



60
61
62
# File 'lib/balboa/cli/command/punch_command.rb', line 60

def to_s
  @date.to_s
end