add "each"

This commit is contained in:
InsanusMokrassar 2020-10-10 21:39:00 +06:00
parent 5a13437c17
commit 66e75b4315
2 changed files with 8 additions and 0 deletions

View File

@ -11,6 +11,7 @@
### 0.3.2
* Function `TimeBuilder#each` was added (works as `at`)
* Add opportunity to use `first` shortcuts:
* Value property `TimeBuilder#first` for including via functions like `TimeBuilder#at`
* Shortcut for kron string format `f` or `F`

View File

@ -48,6 +48,13 @@ sealed class TimeBuilder (
result = (result ?: emptySet()) + value.clamp(restrictionsRange)
}
/**
* Shortcut for [at]. In fact will
*/
@Suppress("unused", "NOTHING_TO_INLINE")
inline infix fun each(value: Int) = at(value)
/**
* Just wrapper for more obvious writing something like "[from] 2 [every] 5". For example, for [SecondsBuilder] it
* will mean "[from] second second [every] 5 seconds", or "2, 7, 13, ..."