mirror of
https://github.com/InsanusMokrassar/krontab.git
synced 2024-11-26 03:58:50 +00:00
KrontabTemplate typealias
This commit is contained in:
parent
cdeea96c54
commit
241fb2ee51
@ -6,6 +6,8 @@
|
||||
* `Kotlin`: `1.3.72` -> `1.4.0`
|
||||
* `Coroutines`: `1.3.8` -> `1.3.9`
|
||||
* `Klock`: `1.11.14` -> `1.12.0`
|
||||
* Typealias `KrontabTemplate` was added
|
||||
* Extension `KrontabTemplate#toSchedule` was added
|
||||
|
||||
## 0.2.0
|
||||
|
||||
|
@ -2,6 +2,12 @@ package com.insanusmokrassar.krontab
|
||||
|
||||
import com.insanusmokrassar.krontab.internal.*
|
||||
|
||||
/**
|
||||
* @see createSimpleScheduler
|
||||
* @see buildSchedule
|
||||
*/
|
||||
typealias KrontabTemplate = String
|
||||
|
||||
/**
|
||||
* Parse [incoming] string and adapt according to next format: "* * * * *" where order of things:
|
||||
*
|
||||
@ -38,7 +44,7 @@ import com.insanusmokrassar.krontab.internal.*
|
||||
*
|
||||
* @see com.insanusmokrassar.krontab.internal.createKronScheduler
|
||||
*/
|
||||
fun createSimpleScheduler(incoming: String): KronScheduler {
|
||||
fun createSimpleScheduler(incoming: KrontabTemplate): KronScheduler {
|
||||
val (secondsSource, minutesSource, hoursSource, dayOfMonthSource, monthSource) = incoming.split(" ")
|
||||
|
||||
val secondsParsed = parseSeconds(secondsSource)
|
||||
@ -55,4 +61,9 @@ fun createSimpleScheduler(incoming: String): KronScheduler {
|
||||
/**
|
||||
* Shortcut for [createSimpleScheduler]
|
||||
*/
|
||||
fun buildSchedule(incoming: String): KronScheduler = createSimpleScheduler(incoming)
|
||||
fun buildSchedule(incoming: KrontabTemplate): KronScheduler = createSimpleScheduler(incoming)
|
||||
|
||||
/**
|
||||
* Shortcut for [buildSchedule]
|
||||
*/
|
||||
fun KrontabTemplate.toSchedule(): KronScheduler = buildSchedule(this)
|
Loading…
Reference in New Issue
Block a user