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