Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function head before body warning fix #67

Merged
merged 1 commit into from
Feb 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lib/crontab/date_checker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ defmodule Crontab.DateChecker do
true

"""
@spec matches_date?(CronExpression.t(), NaiveDateTime.t()) :: boolean | no_return
@spec matches_date?(cron_expression :: CronExpression.t(), date :: NaiveDateTime.t()) ::
boolean | no_return
def matches_date?(cron_expression_or_condition_list, date)

def matches_date?(%CronExpression{reboot: true}, _),
do: raise("Special identifier @reboot is not supported.")

Expand All @@ -35,8 +38,10 @@ defmodule Crontab.DateChecker do
|> matches_date?(execution_date)
end

@spec matches_date?(CronExpression.condition_list(), NaiveDateTime.t()) :: boolean
def matches_date?(condition_list, date)
@spec matches_date?(
condition_list :: CronExpression.condition_list(),
date :: NaiveDateTime.t()
) :: boolean
def matches_date?([], _), do: true

def matches_date?([{interval, conditions} | tail], execution_date) do
Expand Down