Clean parsing
This commit is contained in:
@@ -24,3 +24,6 @@ annotation class Text
|
||||
|
||||
@DayInput
|
||||
annotation class Lines
|
||||
|
||||
@DayInput
|
||||
annotation class Groups
|
||||
|
||||
@@ -60,6 +60,10 @@ class InputFactory(private val resourceLoader: ResourceLoader) {
|
||||
fun text(injectionPoint: InjectionPoint<*>): Input<String> =
|
||||
injectionPoint.read().wrap()
|
||||
|
||||
@Groups
|
||||
fun groups(injectionPoint: InjectionPoint<*>): Input<List<List<String>>> =
|
||||
injectionPoint.read().split("\n\n").map { it.lines() }.wrap()
|
||||
|
||||
|
||||
private fun <T> T.wrap() = Input(this)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user