Sha256: a764176b1f2e75f0894fee2f44dbb2359e5218c56898b640da6c0b660994d2a9
Contents?: true
Size: 954 Bytes
Versions: 1
Compression:
Stored size: 954 Bytes
Contents
# frozen_string_literal: true require_relative '../../punch_date' module Balboa module CLI module Command class PunchCommand def initialize(interactor, cli) @interactor = interactor @cli = cli end def execute punch_dates.each do |date| $stdout.print("\n#{date.strftime("%d/%m/%Y")}") @interactor.punch(date) unless skip_date?(date) end end private def punch_dates yesterday = Date.today - 1 (last_punch_date..yesterday).map do |date| PunchDate.new(date, @cli) end end def skip_date?(date) !date.punchable? || skips_include?(date) end def skips_include?(date) @interactor.options['skips'].include?(date) end def last_punch_date Date.parse(@interactor.last) + 1 end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
balboa-0.1.4 | lib/balboa/cli/command/punch_command.rb |