Class: Balboa::CLI::Command::PunchCommand::PunchDate
- Inherits:
-
Object
- Object
- Balboa::CLI::Command::PunchCommand::PunchDate
- Defined in:
- lib/balboa/cli/command/punch_command.rb
Instance Method Summary collapse
-
#initialize(date) ⇒ PunchDate
constructor
A new instance of PunchDate.
- #punchable? ⇒ Boolean
- #strftime(format) ⇒ Object
- #to_s ⇒ Object
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
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_s ⇒ Object
60 61 62 |
# File 'lib/balboa/cli/command/punch_command.rb', line 60 def to_s @date.to_s end |