Is there any chance this could be added (I hope I ...
# hoplite
d
Is there any chance this could be added (I hope I did it right...)?
Copy code
class IntRangeDecoder() : Decoder<IntRange> {
    override fun supports(type: KType): Boolean = type.classifier == IntRange::class

    override fun decode(node: Node, type: KType, context: DecoderContext): ConfigResult<IntRange> = when(node) {
        is StringNode -> runCatching {
            node.value.split("..").let { IntRange(it[0].toInt(), it[1].toInt()) }
        }.toValidated { ConfigFailure.DecodeError(node, type) }

        else -> ConfigFailure.DecodeError(node, type).invalid()
    }
}